Graph relationship filtering is not working

Hi everyone,

I have two types of nodes User and Action and one type of relationship called NEXT_STEP which can be in between User and Action and Action and Action. Every relationship has three properties: step, addr and timestamp. I want to filter based on the addr property. I use the following query:

MATCH p=()-[r:NEXT_STEP]->() WHERE r.addr = "####" RETURN p

When I return r it works well and shows only the filtered relations but when I return p the table is fine but the graph visualisation shows other relations as well that have different addr properties.

Does anyone have any idea why I can't present only the filtered relations in the graph visualisation?

Thank you for the help!

Hi Dora,
I assume you use the Neo4j Browser for visualization, right? Contrary to expectations, Neo4j Browser not only shows the selected relations between two nodes, but always all relations that exist between the nodes in the result set.
A potential solution might be to project the result into a virtual graph - not really sure.
Alternatively you could use SemSpect which allows to filter down relations by their attribute values (disclaimer, I am one of the SemSpect developers): Neo4j Graph App | SemSpect

1 Like

Yes I tried it in Neo4j Browser I assumed it had to be something like that but I still thought they could be filtered somehow. I will have a look at SemSpect thank you.

The feature in question to connect result nodes can be easily disabled.

In the Neo4j Browser, open the Browser Settings pane (the gear icon in the lower left), then scroll to the end of that pane. There will be a checkbox reading "Connect result nodes". Uncheck that, and you will no longer see other existing relationships in graph result views aside from what you've explicitly queried for.

2 Likes

Thanks for this hint.