How to display all nodes on screen in neo4j

我只是一个虾纸丫 提交于 2020-01-04 05:19:10

问题


I have a almost 5000 nodes of Recipes and 5 nodes of Meal_Types in neo4j database. Right now there is no relationship between them. I am running CQL below:

MATCH (n) RETURN n LIMIT 100000

This is running fine, but it is returning node related to Recipes only. There may be something hidden, I mean there might be nodes related to Meal_Types but as they are in same color it is very hard to differentiate them.

So is there a way to bring all nodes to dispaly with different colors respectively?


回答1:


You can change the styling of the output in the neo4j browser as described here:

https://neo4j.com/developer/guide-neo4j-browser/#_styling_neo4j_browser_visualization

However, there is a limit for the number of nodes/relationships that can be displayed. So you will likely not see all 5000 Recipe nodes and all 5 Meal_Type nodes but rather the first N nodes returned from your query.

Rendering of large graphs is really difficult :)




回答2:


Since you write about "display" and "colors", I assume you're writing about the Neo4j browser.

Your query might limit its results to the first 100000, but the browser will actually display much less nodes, with a default number of 300. You can change that value using the following command in the browser:

:config initialNodeDisplay: 1000

or through the settings pane on the bottom left (see the "Graph Visualization" section).

Since you only have 5 Meal_Types nodes, vs 5000 Repices, it's unlikely they'll be part of any partial result. You can bias the result by ordering on the label, since Meal_Type will sort alphabetically before Recipes:

MATCH (n)
RETURN n
ORDER BY head(labels(n))
LIMIT 300

That way, you don't need to display more nodes (since you can't zoom out, it's pretty useless anyway) and you'll always get your 5 Meal_Types.



来源:https://stackoverflow.com/questions/38501814/how-to-display-all-nodes-on-screen-in-neo4j

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!