Search code examples
cyphergraph-databasesmemgraphdb

Difference with queries regarding BFS


Could someone give me some hints about this? This query works:

match path=(n)-[*bfs..10]->(m) 
return path limit 1;

however I get a memory limit exceed exception with this one:

match path=(n)-[*bfs..1000]->(m) 
return path limit 1;

Shouldn't the second query result in the same path as in the first query? Considering the same dataset?


Solution

  • It should result in the same path, but it's probably not strange that it results in a memory limit exception. Depending on the size and type of your graph, having a limit of 1000 for the path length could eat up a massive amount of RAM as the number of paths generated rises considerably by raising the path length.