cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

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?

9 REPLIES 9

andreperez
Graph Buddy

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

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

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

Did you get ans for this ? 

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!

check the last comment by bucweat at

https://github.com/merqurio/neo4jupyter/issues/7

fskpf
Node Link

A bit late to the party, but you can also try yfiles-jupyter-graphs.

There is also a sample notebook here: import_from_neo4j.ipynb

This presentation from NODES2022 also shows how it works: (1) 065 Explore Your Graphs Visually With Jupyter Notebooks - NODES2022 - Sebastian Müller - YouTube