Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-06-2020 05:19 PM
Hi,
I have a path:
(node1)->(node2)->(node3)->(node4)
also, I have "node5" connected to "node2", and "node6" connected to "node3"
Is it possible to get the paths from node1 to node4 with all the nodes and relationships in between, and also all the nodes that are related to node2 and node3 (node5 and node6) with one query?
Thanks!
Solved! Go to Solution.
10-07-2020 06:23 AM
Sorry, couldn't understand the requirement here.
Are you looking for an output like:
node1-> node2-> node3 -> node4
node5 -> node2
node6 -> node2
or all nodes together ?
10-06-2020 07:33 PM
It depends on the relationship type between (node1 and node2) and (node2-node5). Let me know the type of relationships.
10-07-2020 02:42 AM
Thank you for the help!
Can you please explain?
Let's say all have "CONTAINS" relationships, directions are like in the diagram:
(node1)-[r:CONTAINS]->(node2)
(node5)-[r:CONTAINS]->(node2)
(node6)-[r:CONTAINS]->(node3)
(node2)-[r:CONTAINS]->(node3)
(node3)-[r:CONTAINS]->(node4)
Thanks
10-07-2020 09:30 AM
Try this:
MATCH (a:node1)
CALL apoc.path.spanningTree(a, {})
YIELD path
RETURN path
10-07-2020 06:23 AM
Sorry, couldn't understand the requirement here.
Are you looking for an output like:
node1-> node2-> node3 -> node4
node5 -> node2
node6 -> node2
or all nodes together ?
All the sessions of the conference are now available online