With this query you can get all the relationship between two nodes
MATCH (n1)-[r]->(n2)
RETURN {type: type(r), nodes: {n1: n1{.*}, n2: n2{.*}}}
OR
MATCH (n1)-[r]->(n2)
RETURN {type: type(r), nodes: {n1: collect(distinct n1{.*}), n2: collect(distinct n2{.*})}}
Get employees by common properties:
MATCH (e:Employee)-[]-(m:Month)
return {
month: m.month, // You can replace it with any property you want to group for example "gender: e.gender"
employees: collect(distinct e{.*})
} as byMonth
EDIT
How to know other employees similar to the given Employee​ id. for example, I was working for a company (my age, location, year of joining as data) and I want to know the employees in the company who has similar relationships like same age, year of joining, the month of joining, location etc. w.r.t to me
Below query should work
match (employee:Employee) where employee.empid= 1
optional match (employee)-[:EMPLOYEE]-(month:Month{month: 10})-[:EMPLOYEE]-(other:Employee)
optional match (other) where other.monthOfJoining = employee.monthOfJoining or other.yearOfJoining = employee.yearOfJoining or other.age = employee.age
return employee, other
EDIT 2
Get count of all common nodes related to two or more nodes
MATCH (node1:Employee)-->(r)<--(node2:Employee)
with count(r) as maxCountRelation, node1{.*} as e1, node2{.*} as e2
return {commonRelation: maxCountRelation, employees: collect(distinct e1)+collect(distinct e2)} as result order by result.commonRelation desc limit 1