Summing up weights of k shortest paths

Hi @kostjaigin, Thanks for your questions.

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.

From the docs:

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

1 Like