6 ms·
How would you query for a path or cycle of arbitrary length in GraphQL?
by frant-hartm 7y ago
How would you query for a path or cycle of arbitrary length in GraphQL?
- henryfjordan 7y agoYou cannot do that directly out-of-the box, but you can write your server to include directives for that. See some discussion here: https://github.com/graphql/graphql-spec/issues/91 https://github.com/graphql/graphql-spec/issues/91 Also just because you cannot query at arbitrary depths doesn't mean that GraphQL doesn't work with graphs, just that it might be a poor choice of tool for that work.
- prashnts 7y agoThank you, everyone in this thread! These are some helpful insights.
- FridgeSeal 7y agoDGraph is perfectly capable of doing these with a query language extremely similar to GraphQL (and as of v2 will natively support GraphQL): https://docs.dgraph.io/master/query-language/#k-shortest-path-queries https://docs.dgraph.io/master/query-language/#k-shortest-pat...