The all-pairs shortest path algorithm goes even further: it returns the shortest path between each pair of nodes in the projected graph. It is equivalent to calling the SSSP for each node, but with performance optimizations to make it faster.
The GDS implementation procedure for this algorithm looks as follows:
CALL gds.alpha.allShortestPaths.stream(graphName::STRING, configuration::MAP)
YIELD sourceNodeId, targetNodeId, distance
The configuration parameters include, as usual, relationshipWeightProperty, the relationship property in the projected graph to be used as the weight.
There are two additional parameters to set the number of concurrent threads: concurrency and readConcurrency.
We can use it on our small test graph with the following:
CALL gds.alpha.allShortestPaths.stream("graph_weighted", {
relationshipWeightProperty: "weight"
})
YIELD sourceNodeId, targetNodeId, distance
RETURN gds.util.asNode(sourceNodeId).name as start,
gds.util.asNode...