Showing results for 
Search instead for 
Did you mean: 

Sorting out Nodetypes after yield in Neo4jClient

Hi, for full context please check out the stackoverflow post.

The part that is relevant here:
I have this query

Match(n1: Red)
Where n1.Id = "someId"
Call apoc.path.subgraphAll(n1,{ minLevel: 0,maxLevel: 100,relationshipFilter: "link",labelFilter: "+Red|Blue"})
Yield nodes, relationships
Return nodes, relationships

It works as intended. The graph has a structure that is roughly alternating "Red" and "Blue" nodes with the same type of edge between them.

My problem is that I need to separate out the Red and Blue nodes into separate sets to make the deserialization work in C#. I think I can manage once I have the two sets separated.

So how do I use the nodes set from the yield and separate it based on node type?

In the end I want to "return Red, Blue, Relationships"


Graph Maven
Try this:

Where = 1
Call apoc.path.subgraphAll(n1,{})
Yield nodes, relationships
unwind nodes as n
unwind relationships as rel
with collect(id(n)) as ID, labels(n) as lbl, count(n) as cnt, type(rel) as type
return ID, lbl, cnt, type


Nodes 2022
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.