Hi!
According to the docs Dgraph’s GraphQL± provides us with a functionality to calculate k-shortest-paths between two nodes and even use the calculation as a variable:
But i cannot find a way to access weights or even path section from my query. Is there a way to sum weights up in another variable to use it in further queries?
Which variable are you talking of? In your query, calc will only store the shortest path. But _path_ will store the other paths and respective weights.
For k-shortest paths (when numpaths > 1), the result of the shortest path query variable will only return a single path. All k paths are returned in _path_ .
Do you want to add weights of different paths returned inside _path_ ? I don’t think that is possible via only a gql± query. You need to parse the JSON struct with _path_ key and use those weights again in a different query which you want to make