I am facing difficulty to retrieve the highest no of relationships shared by two nodes from the data. i am able to count highest no of relations but hard to show in a graph.
MATCH path = (e1:Employee) -->(n)<--(e2:Employee)
WITH count(n) as count,e1 as employee, e2 as employees
WHERE count > 2
RETURN count,employee,employees
MATCH (e1:Employee)-[r]-(e2:Employee)
WHERE id(e2) <> id(e1)
RETURN distinct e1.empid as emp, type(r) as rel, count(r) as cnt ORDER BY cnt desc
Say if rel = "R1" has maximum count, then
MATCH (e1:Employee)-[:R1]-(e2:Employee)
RETURN e1, e2
Thanks for the info. This shows Employee node is having relationships with nodes that represent the employee location. Looks like no two employee nodes are connected directly.
Try this:
MATCH (e1:Employee)-[]-(e2:Employee)
RETURN e1, e2
Try this:
match (e:Employee)-[]-(y:Year)
with distinct y.year as year, collect(distinct e.empid) as eid
return year, eid, size(eid)
This gives you the number of employees joined in a given year. eid is an array of empires and size(eid) is like count of employees.