Probably a simple MATCH statement

Learning CYPHER, so this is probably a beginner level question...

My Person node can have an arc to an A node, which has a name. It can also have an arc to a B node, which likewise has a name. How do I find Persons who have at least one A arc and at least one B arc, so I can get the names from the A and B nodes?

Hello @jeg and welcome to the Neo4j community :slight_smile:

This is a template, you can add labels to node, and relations type between node if they are useful :)
The query return the name of the Person and a list of names for a and b.

MATCH (a)--(p:Person)--(b)
RETURN AS p_name, collect( AS a_names, collect( AS b_names


Thank you very much! That did indeed get me going, and I was able to whittle it down to the exact query.