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.

yfiles jupyter notebook integration

DMF194
Node Clone

Hi all,

My name is Fong, I am currently learning to use yfiles with Jupyter notebooks but so far I have encountered issues.

I am currently using this link: https://www.youtube.com/watch?v=M_PbbMVg4ME as a guide but my GraphWidget is not displaying at all, I have attached a snapshot as shown below.

DMF194_0-1671602973250.png

If anyone knows how to overcome this issue, do let me know in the comments. Below is the link to the yfiles github page

#https://github.com/yWorks/yfiles-jupyter-graphs

 

1 ACCEPTED SOLUTION

I can reproduce the same issue when I'm calling graph() twice, e.g. 

result = session.run("MATCH (s)-[r]->(t) RETURN s,r,t LIMIT 20").graph()

w = GraphWidget(graph = result.graph())

So try to call graph() only once on the result.

View solution in original post

3 REPLIES 3

fskpf
Node Link

Hi,

is the widget loading with an empty graph, or is the widget itself missing?

You could also check whether your queried graph actually contains nodes and relationships, e.g.

print(graph.nodes.__len__())
print(graph.relationships.__len__())

Other than that, you can try the import_from_neo4j.ipynb notebook in the samples of the yfiles-jupyter-graphs GitHub repository.

This should work out of the box, and with the latest release of yfiles-jupyter-graphs (v1.4.2) you can also easily run it in Visual Studio Code if you dislike JupyterLab. 

 

Hi there @fskpf ,

The graph is not empty and has nodes and relationships

DMF194_0-1671838047155.png

However I noticed something different, the graph widget itself is showing when using this code

DMF194_1-1671838137163.png

When I try to use the widget to visualize my graph, the error is shown below


@fskpf wrote:

Hi,

is the widget loading with an empty graph, or is the widget itself missing?

You could also check whether your queried graph actually contains nodes and relationships, e.g.

print(graph.nodes.__len__())
print(graph.relationships.__len__())

Other than that, you can try the import_from_neo4j.ipynb notebook in the samples of the yfiles-jupyter-graphs GitHub repository.

This should work out of the box, and with the latest release of yfiles-jupyter-graphs (v1.4.2) you can also easily run it in Visual Studio Code if you dislike JupyterLab. 

AttributeError                            Traceback (most recent call last)
<ipython-input-11-32a4228e4dae> in <module>
      3 
      4 #shows empty widgets
----> 5 graph_db=GraphWidget(graph = result.graph())
      6 graph_db.show()

AttributeError: 'Graph' object has no attribute 'graph'

 

I can reproduce the same issue when I'm calling graph() twice, e.g. 

result = session.run("MATCH (s)-[r]->(t) RETURN s,r,t LIMIT 20").graph()

w = GraphWidget(graph = result.graph())

So try to call graph() only once on the result.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online