Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-06-2021 10:18 AM
I am trying to return similar relationships if a similar relationship counts greater than some value for a given node.
//maxcount
MATCH path = (e1:student{FN:'Holli'}) -->(n)<--(e2:student)
with count(n) as n,e1,e2
where n>21
return e1 as student_x,e2 as student_y,n as similar_relationship
Here i can find the count of common relationships between nodes.
How can i show what are the common relationships between two nodes?
OUTPUT I GOT
04-07-2021 02:02 AM
Hello,
You just need to add a collect(relationships(path)) in your WITH statement. This will regroup all paths matching each {e1,e2} pair in a single collection.
If you don't add the collect in, you would get one path per row, and your count would always be 1.
Like so :
MATCH path=(e1:student{FN:"Holli"})-->(n)<--(e2:student)
WITH e1, e2, count(n) as count, collect(relationships(path)) as rels
WHERE count > 3
RETURN e1 as student_x,e2 as student_y, count as similar_relationship, rels
04-07-2021 05:33 AM
Thank you, I tried above query but not showing relationships
04-07-2021 05:49 AM
Yes, it does not show them in the "Graph" view of Neo4j browser, but if you go to the "Table" view, you'll see a "rels" column, with arrays of relationships in it.
04-07-2021 07:34 AM
Actually i seen but column is empty.
04-08-2021 12:05 AM
This is because your relationships don't have any properties.
If you look here, my Text view with similar query for the Movies dataset, my rels that have properties show them, and those which don't have properties appear as an empty map :
But if you go to the "Table" view, I do see all relationships, with all their info (startNode, endNode, type, and properties map) :
All the sessions of the conference are now available online