How to load CSV data into Memgraph using Python and run DFS algorithm on it?

Please share how I should load CSV data from a local directory into memgraph and then run DFS algorithm using python.

1 Like

Loading CSV files

You should probably use the LOAD CSV Cypher clause in order to load the dataset. Here is a link to a simple guide that demonstrates how to load a CSV file step-by-step.

DFS

Did you try relationship traversals without specifying BFS as the method? This should result in a DFS traversal of the nodes and relationships. You can also specify the depth using the parameters minHops and maxHops:

MATCH ({name: 'United Kingdom'})<-[:LIVING_IN*1..2]-(n)
RETURN n;

Here is a link to the documentation.