How can I find multiple shortest path using Memgraph and MAGE? I'm looking for a solution that would use Yen's, Dijkstra's or Star algorithm.
Memgraph has some built-in algorithms that help you find all shortest paths.
For example, to obtain all shortest paths, you need to call [*ALLSHORTEST (r, n | r.weight)]
where r
and n
define the current expansion relationship and node.
The following is a weighted query based on the weight property on each visited relationship:
MATCH path=(n {id: 0})-[:Type *ALLSHORTEST (r, n | r.weight)]-(m {id: 5})
RETURN path;
A more detailed explanation can be found at https://memgraph.com/docs/memgraph/reference-guide/built-in-graph-algorithms