Showing results for 
Search instead for 
Did you mean: 

Finding One To One Relations

Hello i need help about one query .Here is my Node A.
I want to find results where nodes labeled "A"and "B "goes to only one value in nodes to which it is attached. For example ;node A goes only C1 with A1 and goes C2 with A2. For A-D relations we have (A1-D1) ,(A1-D2) so i dont want A-D.Same as (B2-C2),(B2-C1).For this daTabase i want to return this {A,C} and {B->D} .

For this query;

MATCH p=(n:A)-[R]->(m)   
RETURN  (collect( DISTINCT [n.deger,m.deger]))

result is

[["A1", "D1"], ["A1", "E2"], ["A1", "D2"], ["A1", "C1"], ["A1", "B2"], ["A1", "E1"], ["A1", "B1"], ["A2", "E2"], ["A2", "D2"], ["A2", "C2"], ["A2", "B2"], ["A2", "B1"]]

If I can make the initial values a1 and a2 as keys, I can find that a single labeled value C (C1) for a1 and a single labeled value (c2) for a2. I will find that I went to the value with more than one e tag for a1 and I will not print it.
I would be happy if somebody can show me how can i achive this