Skip to main content

Graph Visualization for Python by Neo4j

Latest version PyPI downloads month Python versions Documentation Discord Community forum License

neo4j-viz is a Python package for creating interactive graph visualizations.

The output is of type IPython.display.HTML and can be viewed directly in a Jupyter Notebook or Streamlit application. Alternatively, you can export the output to a file and view it in a web browser.

The package wraps the Neo4j Visualization JavaScript library (NVL).

Example Graph

Some notable features

  • Easy to import graphs represented as:
    • projections in the Neo4j Graph Data Science (GDS) library
    • graphs from Neo4j query results
    • pandas DataFrames
  • Node features:
    • Sizing
    • Colors
    • Captions
    • Pinning
    • On hover tooltip
  • Relationship features:
    • Colors
    • Captions
    • On hover tooltip
  • Graph features:
    • Zooming
    • Panning
    • Moving nodes
    • Using different layouts
  • Additional convenience functionality for:
    • Resizing nodes, optionally including scale normalization
    • Coloring nodes based on a property
    • Toggle whether nodes should be pinned or not

Please note that this list is by no means exhaustive.

Getting started

Installation

Simply install with pip:

pip install neo4j-viz

Basic usage

We will use a small toy graph representing the purchase history of a few people and products.

We start by instantiating the Nodes and Relationships we want in our graph. The only mandatory fields for a node are the "id", and "source" and "target" for a relationship. But the other fields can optionally be used to customize the appearance of the nodes and relationships in the visualization.

Lastly we create a VisualizationGraph object with the nodes and relationships we created, and call its render method to display the graph.

from neo4j_viz import Node, Relationship, VisualizationGraph

nodes = [
    Node(id=0, size=10, caption="Person"),
    Node(id=1, size=10, caption="Product"),
    Node(id=2, size=20, caption="Product"),
    Node(id=3, size=10, caption="Person"),
    Node(id=4, size=10, caption="Product"),
]
relationships = [
    Relationship(
        source=0,
        target=1,
        caption="BUYS",
    ),
    Relationship(
        source=0,
        target=2,
        caption="BUYS",
    ),
    Relationship(
        source=3,
        target=2,
        caption="BUYS",
    ),
]

VG = VisualizationGraph(nodes=nodes, relationships=relationships)

VG.render()

This will return a IPython.display.HTML object that can be rendered in a Jupyter Notebook or streamlit application.

Please refer to the documentation for more details on the API and usage.

Examples

For more extensive examples, including how to import graphs from Neo4j GDS projections and Pandas DataFrames, checkout the tutorials chapter in the documentation.

Release files for neo4j-viz 1.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neo4j-viz 1.9.0
File Size Uploaded
neo4j_viz-1.9.0.tar.gz 5.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for neo4j-viz 1.9.0
File Interpreter ABI Platform
neo4j_viz-1.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.0 MB

Release files / neo4j_viz-1.9.0.tar.gz

Download URL neo4j_viz-1.9.0.tar.gz
Size 5.5 MB
Tags Source
SHA-256 checksum
How to use checksums
afc014af929395512cb847d907a056b3bd44c269531f96cae1105b58d96ca7fd
BLAKE2b-256 checksum
How to use checksums
c3e6206612a3b2d6d783442070a6ef65a602aa9450aea4dbf0bf58d9fc7083e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / neo4j_viz-1.9.0-py3-none-any.whl

Download URL neo4j_viz-1.9.0-py3-none-any.whl
Size 5.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
9c0be5fb611d4338bda771c77e50f1994aa3148dcb76e0d267a4e0f5d11baed2
BLAKE2b-256 checksum
How to use checksums
eedcf9b7bdda94809baad1c50d012303c468a57d3ac035d98a78666002c5f230
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

1.10.0

2 release files

This release

1.9.0 This release

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.4

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page