Need cypher a query

I am new to neo4j can you please help to write a cypher query for the following subgraph. We are using neo4j.3.5.x version.

A--->next--->S1<----Has-----S
A--->.next---->S2<-----Has----S
B--->next--->T1<----Has-----T
B--->next--->T2<----Has-----T
B--->.next---->M1<-----Has----M

I need B node because which connected differnt END nodes T,M.

@rayapatir4, do you want to create a graph or you want to search node B?

I need find query.I need B node as it participated in 2 different end nodes T,M
image
image

Hello @rayapatir4 :slight_smile:

A request in the same style could do the job (you can add a Label to nodes):

MATCH (a)-[:NEXT]->()<-[:HAS_INSTANCE]-(c)
WITH a, count(DISTINCT c) AS nb_nodes
WHERE nb_nodes >= 2
RETURN a

Regards,
Cobra

1 Like

@cobra,

Thank you for your quick help. Its working as expected.

No problem :) I'm happy to hear it :slight_smile: