Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

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 - November 16 - 17, 2022.

Free NODES Training Series

October 19th -

Intro to Neo4j

October 20th -

Healthcare Analytics Using Neo4j

October 25th -

Handling Neo4j data with Apache Hop

October 26th -

Blazing Fast Graphs: Hands-on with Apache Arrow and Neo4j

November 2nd -

Graph EDA Using the Neo4j GDS Client