How to write a query to find highest no common relationships between two nodes?

I am trying to return similar relationships if a similar relationship counts greater than some value for a given node.

          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?


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

Thank you, I tried above query but not showing relationships

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.

Actually i seen but column is empty.

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) :