Repository navigation
Conversation
| Set<FieldVertex> curSourceSet = new LinkedHashSet<>(); | ||
| curSourceSet.add(rootVertex); | ||
|
|
||
| while (!curSourceSet.isEmpty()) { |
There was a problem hiding this comment.
@andimarek
This is a topological sorting algorithm.
Currently it is used to perform static analysis only, but it actually needs to be used to do the field resolution.
The main difference between these 2 cases is that during query execution the actual runtime data should be used to evaluate vertex predicate and if that fails, that vertex and all its dependents should be excluded from the topological sequence so they won't make their entries in the resulting object.
| traverser.rootVar(FieldVertex.class, rootVertex); | ||
| allVertices.add(rootVertex); | ||
| List<MergedFieldWithType> roots = fieldCollector.collectFromOperation(parameters, operationDefinition, graphQLSchema.getQueryType()); | ||
| traverser.traverse(roots, new TraverserVisitorStub<MergedFieldWithType>() { |
There was a problem hiding this comment.
I think recursive collecting fields (graph traversal!) and then traversing collected fields again to build a graph is quite redundant. I would suggest to build the graph in 1 traverse cycle, incrementally with field collection.
|
outdated. We have now a |
@gkesler @exbe here is my early PR for adding the dependency graph. Not really ready yet.
Inside
createDependencyGraphit creates dot file representation of the graph which you can try out for example here: https://dreampuf.github.io/GraphvizOnline/