How to automatically expand child relationships in neo4j

2.4k Views Asked by At

When I run a query I can see the nodes correctly. But I need to go one by one and click "Expand child relationships" which is tedious and time consuming. Is there any way to see the graph with everything already expanded?

Thanks!

2

There are 2 best solutions below

3
On BEST ANSWER

You're talking about Neo4j Browser, right? If so, you need to specify exactly what you need to visualize first. So let's say you have a User node that is connected to a Book node with a read relationship. Instead of just

MATCH (u:User)
RETURN u

And expanding that node to see all other connected nodes, just do

MATCH (u:User)-[:read]->(b:Book)
RETURN *

And just add the relationships you want in the query itself.

You can, however, do

MATCH (n) RETURN n

Which will return every node with its relationship, but there's a limit to how many nodes you can see. You can extend the limit in the settings (bottom left of the navigation bar) and tinkering with Graph Visualization values. This is not recommended and, depending on the size of your graphdb, it could cause a bottleneck and it can take a lot of time.

My advice, just write a query that shows exactly which nodes and relationships you want to see.

0
On

The Neo4j Browser supports an "auto-completion" mode that, when enabled, automatically queries for (and displays) the relationships between the nodes returned by a Cypher query.

In the most recent versions of the Browser, you can enable auto-completion mode by clicking the gear icon on the left side, scrolling to the bottom of the Browser Settings panel, and check-marking the "Connect result nodes" option.