Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-20-2021 08:33 AM
I have a large neo4j graph dataset, where I am trying to get all the nodes present along the path from node A to be node B, which would include the connecting nodes in-between as well as A and B(Let's give the label for these nodes between A and B 'T'). However, when using this query:
MATCH (from:A{ name:'NameA'} ) CALL apoc.path.subgraphNodes(from, { labelFilter:"T|B"} ) YIELD node RETURN node
I get all the nodes that point to B, including those that don’t originate from A. Any help would be appreciated.
01-20-2021 10:17 AM
You could try this:
MATCH path = (from:A {name:'A'})-[*1..]->(to:B)
WITH nodes(path) as nn
UNWIND nn as n
WITH n
WHERE n:T
RETURN n
Typically the graph is faster if you define the REL being traversed though if it's unique.
01-20-2021 10:30 AM
MATCH path = (a:A)-[*0..]->(b:B)
RETURN nodes(path)
All the sessions of the conference are now available online