Home > Back-end >  How to load CSV data from a local directory into Memgraph?
How to load CSV data from a local directory into Memgraph?

Time:10-13

How to load CSV data from a local directory into Memgraph and then run the DFS algorithm using Python?

CodePudding user response:

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: https://memgraph.com/docs/memgraph/import-data/load-csv-clause

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 minHopsand maxHops:

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

Here is a link to the documentation if you want a more detailed explanation: https://memgraph.com/docs/cypher-manual/clauses/match#3-matching-with-variable-length-relationships

  • Related