neo4jneo4j-browser

How to automatically expand child relationships in neo4j


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!


Solution

  • 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.