Hi There,
I am a newborn baby in Neo4j world. I have downloaded version 4.0.3. I tried browsing for an answer to my requirement, but couldn't find one that exactly matches my need.
I have created 10 person nodes as below:
CREATE (U1:Person {UID:'1',Name:'Person1'}),
(U2:Person {UID:'2',PName:'Person2'}),
(U3:Person {UID:'3',PName:'Person3'}),
(U4:Person {UID:'4',PName:'Person4'}),
(U5:Person {UID:'5',PName:'Person5'}),
(U6:Person {UID:'6',PName:'Person6'}),
(U7:Person {UID:'7',PName:'Person7'}),
(U8:Person {UID:'8',PName:'Person8'}),
(U9:Person {UID:'9',PName:'Person9'}),
(U10:Person {UID:'10',PName:'Person10'})
I have created a relationship "Met" with property "Date" as below:
CREATE (P1:Person {UID:'1'})-[:Met {Date:'25-Apr-2020 14:00'}]->(P2:Person {UID:'2'}),
(P1)-[:Met {Date:'25-Apr-2020 14:00'}]->(P3:Person {UID:'3'}),
(P2)-[:Met {Date:'25-Apr-2020 14:00'}]->(P1),
(P3)-[:Met {Date:'25-Apr-2020 14:00'}]->(P1)
CREATE (P2:Person {UID:'2'})-[:Met {Date:'26-Apr-2020 10:00'}]->(P4:Person {UID:'4'}),
(P2)-[:Met {Date:'26-Apr-2020 10:00'}]->(P5:Person {UID:'5'}),
(P4)-[:Met {Date:'26-Apr-2020 10:00'}]->(P2),
(P5)-[:Met {Date:'26-Apr-2020 10:00'}]->(P2)
CREATE (P3:Person {UID:'3'})-[:Met {Date:'26-Apr-2020 14:00'}]->(P6:Person {UID:'6'}),
(P3)-[:Met {Date:'26-Apr-2020 14:00'}]->(P7:Person {UID:'7'}),
(P6)-[:Met {Date:'26-Apr-2020 14:00'}]->(P3),
(P7)-[:Met {Date:'26-Apr-2020 14:00'}]->(P3)
CREATE (P4:Person {UID:'4'})-[:Met {Date:'27-Apr-2020 8:00'}]->(P8:Person {UID:'8'}),
(P4)-[:Met {Date:'27-Apr-2020 8:00'}]->(P9:Person {UID:'9'}),
(P8)-[:Met {Date:'27-Apr-2020 8:00'}]->(P4),
(P9)-[:Met {Date:'27-Apr-2020 8:00'}]->(P4)
CREATE (P8:Person {UID:'8'})-[:Met {Date:'27-Apr-2020 10:00'}]->(P10:Person {UID:'10'}),
(P10)-[:Met {Date:'27-Apr-2020 10:00'}]->(P8)
When I run "match(n) return n". I can see some hanging nodes without a relationship though each one of them is linked.
Query:
(1) I wanted to know if the graph displayed is how it will be?
(2) I want to retrieve all the friend's friend with level and date they met by passing a friend id
for e.g
PersonID FriendID Depth
1 2 1
1 3 1
2 4 2
2 5 2
3 6 2
3 7 2
4 8 3
4 9 3
8 10 4
If I can also get the Date Met, it will be great.
Thanks in advance...