How to run the Dijkstra Algorithm on a dataset in Memgraph

How can I run the Dijkstra Algorithm in python in Memgraph on karate club friendship network dataset?

1 Like

Hi @anberarif :smile:
Here is an example query that finds the shortest path between the users with the ids "7" and "13":

MATCH p = (u1:User)-[:FRIENDS_WITH * wShortest (e,v | 1) count]-(u2:User)
WHERE u1.id="7" AND u2.id="13"
RETURN p, count;
1 Like

Hi @idespot :grinning:
I created the attached python file in which I am using the Dijkstra algorithm but when I run the file, it’s giving me an empty list. Can you have a look at the .py file and let me know what can I change to return the results. Here is my dataset and the .py file.
Dataset
Python file