Browser displaying all relationships between two nodes, even when filtered out

Browser displaying all relationships between two nodes, even when filtered.

This code shows the problem, if you have the time to run it I'd be very grateful.

merge (:Entity { name: 'Zara' } );
merge (:Age {value: '30-34'});
merge (:Gender {value: 'Female'});
merge (:Location {value: 'Johannesburg'});

match (e:Entity     { name:  'Zara'})
match (a:Age        { value: '30-34'})
match (g:Gender     { value: 'Female'})
match (l:Location   { value: 'Johannesburg'})
merge (e)-[:Question {Label: 'T1'}]->(a)
merge (e)-[:Question {Label: 'T1'}]->(g)
merge (e)-[:Question {Label: 'T1'}]->(l);

match (e:Entity     { name:  'Zara'})
match (a:Age        { value: '30-34'})
match (g:Gender     { value: 'Female'})
match (l:Location   { value: 'Johannesburg'})
merge (e)-[:Question {Label: 'T2'}]->(a)
merge (e)-[:Question {Label: 'T2'}]->(g)
merge (e)-[:Question {Label: 'T2'}]->(l);

MATCH p = (e:Entity)-[q:Question]->() where q.Label = 'T1' RETURN p

What I'd like is a single relationship displayed between the central "Entity" node and each of the surrounding nodes. What I'm getting is both the T1 and T2 relationships displayed....

Hopefully it will be a common error or design issue that people can have a laugh at as you point out my neo inexperience. Seriously, comments are very welcome.

There is a setting in Neo4j Browser that when set shows all the relationships between the returned nodes. You can disable it to get what you want. The setting is "Connect result nodes."

Screen Shot 2022-03-08 at 5.40.04 PM

Hello Gary,

Thank you - that does exactly what I wanted.

It is best practise not to do this?

No worries. I had the same issue when starting.

It depends on your requirements. I like it checked most of the time, since I can query for nodes and it shows me all the relationships too. It helps visualize. I like it unchecked when I am querying for specific patterns, as you are doing.

Sounds good, thx again