cypher - Neo4j: Finding simple path between two nodes takes a lot of time -
Neo4j: Finding Simple Path Between Two Nodes Even after using upper limit (* 1..4) Takes. I do not want to use all the shortstasts or shortpest as it does not return all the paths.
Mail P = (({{name: "node 1"}} - [* 1..4] -> (mi {name: "node 2"}) returns P; Any suggestions for making it faster?
If you have lots of nodes, try to make an index so that the names with the correct code To search the node 4G DB engine with every node.
I am assuming that, in your example, the n and m nodes are actually the same as the "type" of the node if it is true , Then: -
Add a label to each node (I will call it 'x') (same type of n and m ). You can use the following to add the 'x' label to the node (s) displayed by the variable n . You want to do this before the appropriate MATCH section: SET n: X
-
Create an index at name Property of the nodes with the X label from: Make an index at: x (name);
-
Query for you:
MATCH P = ((N: X {name: "Node1"}) - [* 1..4] - & gt; (M: X {name: "Node2"}) Return p;
If you overwrite, your query should be sharp.
Comments
Post a Comment