yFiles Graphs for Jupyter

yFiles Graphs for Jupyter logo

PyPI version PyPI - Downloads Python Versions License

Using Neo4j, Kuzu, or SPARQL? Use our dedicated integrations instead: Neo4j · Kuzu · SPARQL

A graph visualization widget for Jupyter Notebook and JupyterLab powered by yFiles for HTML.

Visualize graphs from many sources out of the box: - NetworkX ✅ - igraph ✅ - neo4j ✅ (use the dedicated neo4j package) - pygraphviz ✅ - Native Python dicts/lists ✅

Many more formats are supported via NetworkX imports.

Quickstart

Display a simple graph:

from yfiles_jupyter_graphs import GraphWidget, Node, Edge
w = GraphWidget(
    nodes=[
        Node(id=0, properties={"firstName": "Alpha", "label": "Person A"}),
        Node(id=1, properties={"firstName": "Bravo", "label": "Person B"}),
        Node(id=2, properties={"firstName": "Charlie", "label": "Person C", "has_hat": False}),
        Node(id=3, properties={"firstName": "Delta", "label": "Person D", "likes_pizza": True})
    ],
    edges=[
        Edge(start=0, end=1, properties={"since": "1992", "label": "knows"}),
        Edge(start=1, end=3, properties={"label": "knows", "since": "1992"}),
        Edge(start=2, end=3, properties={"label": "knows", "since": "1992"}),
        Edge(start=0, end=2, properties={"label": "knows", "since": 234})
    ],
    directed=True
)
display(w)

Key Features

  • Fast, production-grade graph rendering (yFiles engine)
  • Multiple automatic layouts (hierarchical, organic, circular, ...)
  • Data-driven styling (colors, sizes, labels, ...) from node/edge attributes
  • Sidebars for search, data inspection, and neighborhood exploration
  • Heatmaps and map visualization

Choose your path

There are extensions built on top of yfiles-jupyter-graphs that provide tailored APIs and convenient data mapping for their respective ecosystems:

Otherwise, continue below with yfiles-jupyter-graphs.

Where it runs

AI Coding Assistant

Working with an AI coding agent? Our agent guide contains instructions and best practices for coding agents.

Example start prompt:

Read the instructions at https://raw.githubusercontent.com/yWorks/yfiles-jupyter-graphs/refs/heads/main/agent-guide.md. Then, create a new Jupyter notebook that step-by-step explores the and visualizes it using yfiles-jupyter-graphs. Be creative and design visualizations that highlight interesting insights and aspects of the data.

neighborhood sidebar
See Node Neighborhood
layouts
Choose Graph Layout
data sidebar
Investigate Nodes or Edges Data
search sidebar
Search for Nodes or Edges
importer
Import Graph Data
element color mapping
Make Data Dependent Property Changes
heat mapping
Define a Heatmap Background
leaflet mapping
Use a Map Background
nested graph
Visualize nested data

For example code look here.

Code of Conduct

This project and everyone participating in it is governed by the Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to contact@yworks.com.

Feedback

This widget is by no means perfect. If you find something is not working as expected we are glad to receive an issue report from you. Please make sure to search for existing issues first and check if the issue is not an unsupported feature or known issue. If you did not find anything related, report a new issue with necessary information. Please also provide a clear and descriptive title and stick to the issue templates. See issues.

Dependencies

License

See LICENSE file.