I am facing an issue while using Neovis.js . I get improper visualization in my front-end which uses Neovis.js code. And when i run the same query in Neo4j Desktop version/browser , i get proper visualization.
I believe the issue is that the names and not the relationships need to be displayed.
Is there a cypher query for displaying the node names and not the relationship names.
Hi Sucheta - could you please clarify what you mean by improper visualization? It sounds like you want to change the captions for the nodes and/or relationships? Could you please give an example of what you'd like the Neovis visualization to include?
Regarding only displaying nodes, Neovis will only show the nodes, relationships, and paths explicitly returned in the Cypher query. So if you run
MATCH (n)-->(m) RETURN n,m
only nodes will shown as the query is only returning nodes (n and m). If you'd like to include relationships in the visualization you'll need to explicitly return relationships (or paths):
I will let you have a closer look. Please check the images -
Neo4j Browser Picture -
Here i have all the nodes with proper relationship names as well as proper node names.
Image using Neovis.js in front-end
Here the relationship names are proper . But the node names as the same as relationship names, which is improper.
The issue is , i ran a code from NodeJS and uploaded the database in Neo4j application . So the visualization in Neo4j browser of that uploaded database is the same. But that using the Neovis.js is improper, as seen in the images above.
Please help to resolve this distinction. Because eventually i shall be displaying using Neovis.js
So the node caption is not what you want. To change node caption you'll just need to add an entry in the labels object in the config to specify the property value that should be used for the caption for each node label. If no configuration is specified then the node label is used.
Neo4j Browser fetches extra relationships between nodes which were not part of the original query. When using neovis, you'll want to query the complete pattern that you want to display.
Something you could try is turning off the extra relationships in Browser, so that you can adjust your Cypher query to include precisely what you want to show.
In Neo4j Browser, turn off the setting called "Connect result nodes" under the "Graph Visualization" section...
You could show exactly the same graph as Neo4j Browser does. You just need to modify your cypher query to MATCH all the nodes and relationships in the RETURN.
I haven't used popoto in a while and have forgotten how it manages styling. You can definitely achieve similar styling in d3.js using css. The most unique aspects of the Browser rendering is the curvature of the arrows, which were artfully crafted by @alistair.jones . Unfortunately the code for the maths is buried in Neo4j Browser.