I have 5 nodes,1,2,3,4,5
the relationship between 5 nodes as below,
1-->2
2-->3
1-->3
2-->4
3-->5
4-->5
online model http://console.neo4j.org/r/8h0c91
use below cypher query to get one level connection nodes
match (n:Person{name:"1"})-[r]-(m:Person) return n,m,r
result:
n r m
(20:Person {name:"1"}) [] (20:Person {name:"1"})
(20:Person {name:"1"}) [(20)-[21:Follow]->(22)] (22:Person {name:"3"})
(20:Person {name:"1"}) [(20)-[20:Follow]->(21)] (21:Person {name:"2"})
which only can get the relationship between 1-->2 and 1-->3,cannot get 2-->3.
use below cypher query y to get sencond level connection nodes.
match (n:Person{name:"1"})-[r:Follow*0..2]-(m:Person) return n,m,r
result:
n m r
(0:Person {name:"1"}) (0:Person {name:"1"}) []
(0:Person {name:"1"}) (1:Person {name:"2"}) [(0)-[0:Follow]->(1)]
(0:Person {name:"1"}) (2:Person {name:"3"}) [(0)-[0:Follow]->(1), (1)-[2:Follow]->(2)]
(0:Person {name:"1"}) (3:Person {name:"4"}) [(0)-[0:Follow]->(1), (1)-[3:Follow]->(3)]
(0:Person {name:"1"}) (2:Person {name:"3"}) [(0)-[1:Follow]->(2)]
(0:Person {name:"1"}) (1:Person {name:"2"}) [(0)-[1:Follow]->(2), (1)-[2:Follow]->(2)]
(0:Person {name:"1"}) (4:Person {name:"5"}) [(0)-[1:Follow]->(2), (2)-[4:Follow]->(4)]
i cannot get the relationship of 4-->5 and 2-->3.
my question is how to get all nodes and relationship between all neo4j nodes.
looking for all reachable nodes from a starting node (and optionally all relationships between them?)
– bagde