How to visualise a neo4j graph in python?

how to receive the graph from neo4j to python. Is there any way that I can visualize that graph developed by neo4j in python?

1 Like

The graph that appears at Neo4J desktop or neo4j browser isn't data itself but the interpretation of data. What's the context of use? You'll display it on a website?

Check this article, most of the alternatives use JavaScript in order to display the data on the frontend.

Hi there,

You may try to use this package 'neo4jupyter' for your requirement.

Following steps are to be carried out:

  1. Install and import the neo4jupyter package.
    1.1. !pip install neo4jupyter
    1.2. import neo4jupyter
  2. Create a py2neo graph object
    2.1. from py2neo import Graph
    2.2. g=Graph(url,auth=(user, password)
  3. Call the neo4jupyter.draw(g,{'label_name':'attribute_name'})

This will visualize the attributes for the given label in Jupyter notebook.

Hope this helps

Thanks
Ishwarya

how do I only visualize a subgraph after query? e.g., query = Graph.run(query).to_subgraph()?

Hello ishwarya.ms.
I'm new to neo4j and to programing in general.
Is there a way to visualize the graph from neo4j with python in JupyterLab?

Thank you for your time!

Hi Sharonahorung,

You may please refer to the my post on the same available in this link: How to visualise a neo4j graph in python? - #2 by andreperez

Thanks
Ishwarya

Hello Ishwarya!
I really appreciate the time you spent to help me.

For the last few hours I have tried to work with 'graphistry' as recommended in the article, but go totaly lost.
It seems very complicated for something so simple.

On the other hand, I got farther using the 'neo4jupyter' package (as you also recommended).
The only problem is that when I run the code:
"neo4jupyter.draw(graph, {"Person": "name", "Apartment": "number"}, physics=True, limit=10)"
all I get is a blank, white result (not even an error):

Any idea how to get further in this direction?

Again, I deeply apritiate the time you have spent for me.
Thank you and all the best!

Did you find any solution?

I know I am late to the party, but this popped up in my search and it seems many are looking for such a tool.

Here is one that will get you interactive graph visualizations in your Jupyter Notebook Cells specifically for Cypher. It's very straightforward to use and has many different options for styling the nodes and relationships. Plus you can put the graph on a heatmap or geo-map, too, group nodes, etc.

GitHub - yWorks/yfiles-jupyter-graphs-for-neo4j: Visualizing neo4j graphs and cypher queries in Jupyter notebooks

Hi,

Yes, you can visualize a graph from Neo4j in Python using libraries like py2neo or neo4j to query the database, and networkx or igraph for visualization :white_check_mark:

Thanks

Hey,
we also lately started a python library to visualize graphs neo4j-viz.

Docs
Repo
Pypi

Happy to hear your feedback!

hi @florentin_dorre , thank you for sharing.

I was testing out the neo4j-viz but it seems lacking full NVL js features like clickInteraction - one of the key user interactions I wanted to implement

as below -
GitHub - neo4j/python-graph-visualization: A Python package for creating interactive graph visualizations didn't see it listed here

could you help confirm on this? or is there any plan that the neo4j team will make this available in this package soon for these interaction handlers? Thank you!

Interaction handlers - Neo4j Visualization Library

Hey @mengjiakang2017 ,
you are correct its not a full 1:1 replacement for NVL.
I would rather see the library as a visualization tool such as Bloom/Explore (of course not nearly as mature).
As NVL is written in JavaScripts, I dont see a good way yet to pass an interaction handler through our python surface.

Could you describe your use-case a bit more?
Maybe instead of exposing the interaction handlers, we could add your feature request directly.

1 Like

hi @florentin_dorre , thank you for getting back to me. basically I’m trying to implement a graph viz and exploration webUI that is user friendly to non-tech users.

for bloom - we found that there is no api so we cannot capture user interactions with the tool to tracking and recommendation engine questions

for python neo-viz, I think we are on the same page that it only have limited functions

for JS NVL, I posted my questions here - Graph visualization With Neo4j Using Neovis.js for end users in web application - #7 by mengjiakang2017

in short, we want to have friendly UI and full track of the user interactions. would love to hear more about your insights!

1 Like