Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-23-2019 07:40 AM
Given a set of nodes, I want to return all relationships within that set without leaving out any nodes that do not have a relationship in that set.
I have no problem getting all nodes that have a relationship within that set, however, I cannot also include nodes that do not have a relationship within the set.
01-23-2019 01:01 PM
Hi,
Use OPTIONAL MATCH to get the other nodes. Here is a sample query:
MATCH (a:Actor)-->(m:Movie)-->(d:Director)-->(t:Theater)
OPTIONAL MATCH(b:Actor)
RETURN a, m, d, t, b;
Result:
-Kamal
01-23-2019 01:10 PM
You can use apoc.algo.cover(nodeList) YIELD rel to get all the relationships between a list of nodes.
All the sessions of the conference are now available online