Getting all connected nodes in a dict

MATCH (n:User)
OPTIONAL MATCH (n)-[r]-(o)
WITH n as Node,{label:labels(o),type:type(r),properties: o} as Neighbor
WITH Node, collect(Neighbour) as Neighbor s
RETURN Node, Neighbors

This will show all the Neighbors in one row

1 Like