Hi,
I could really use some help. I need the paths that the query returns to have end nodes that are root nodes (nodes with no incoming relationships, only outgoing relationships) before it starts counting things.
This query gives me larger counts than it should, so I think it's overcounting or counting things it shouldn't. Is there a way to use apoc.path.subgraphAll
to ensure the end nodes are root nodes?
If there is something like this where tier_2_vendor (company A) in the first line is root end node and tier_3_vendor (company B) in second line is root end node:
AAA<--manufacturer<--tier_2_vendor (company A)
ZZZ<--manufacturer<--tier_2_vendor (company A)<--tier_3_vendor (company B)
and im counting tier_2_vendor
's, then the count here should only be two.
I'm really new to neo4j and I keep getting confused when looking through the docs, any help would be appreciated.
MATCH (f:code)
WHERE f.code IN ["AAA", "ZZZ"]
CALL apoc.path.subgraphAll(f, {
relationshipFilter: "<",
labelFilter: "+manufacturer|+tier_2_vendor|+tier_3_vendor"
})
YIELD nodes
UNWIND nodes AS n
UNWIND labels(n) AS label
WITH label, count(n) AS count
RETURN label, count