Neo4j gets nodes in join order

http://console.neo4j.org/r/z1iafh can return n.name so that it is CREATE (hostname); without adding new properties to the nodes? I can see that there is a sequence in which the nodes in this test database are linked to each other, so I am wondering how I can somehow do this.

enter image description here

START n=node(*) MATCH (n)-[r:CREATE_NODE_COMMAND]->(m) RETURN n

      

+3


source to share


1 answer


First you need to declare an id path

, then add depth and finally you can order the length of the path:



START n=node(*) MATCH p=(n)-[r:CREATE_NODE_COMMAND*..10]->(m)
ORDER BY length(p)
LIMIT 1
RETURN nodes(p)

      

+2


source







All Articles