private void getAllAncestorsImpl(NodeType node, List<NodeType> result, Set<NodeType> visited) {
        if (!parentsOfNode.containsKey(node)) return;
        if (visited.contains(node)) return;

        visited.add(node);

        for (NodeType parentNode : parentsOfNode.get(node)) {
            getAllAncestorsImpl(parentNode, result, visited);
        }
        result.add(node);
    }
Recursive search upwards through the inheritance graph to
retreive all ancestors of the given node.
integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/index/InheritanceGraph.java