GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - neo4j/python-graph-visualization: A Python package for creating interactive graph visualizations

BranchesTags
Open more actions menu

Latest commit

 

History

971 Commits
971 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.vscode
.vscode
 
 
docs
docs
 
 
examples
examples
 
 
js-applet
js-applet
 
 
python-wrapper
python-wrapper
 
 
scripts
scripts
 
 
test-envs/neo4j-gds
test-envs/neo4j-gds
 
 
.gitignore
.gitignore
 
 
.nvmrc
.nvmrc
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
MANIFEST.in
MANIFEST.in
 
 
README.md
README.md
 
 
changelog.md
changelog.md
 
 
justfile
justfile
 
 

Repository files navigation

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 render method returns an IPython.display.HTML object that can be viewed directly in a Jupyter Notebook or Streamlit application. For an interactive widget experience, use render_widget() which returns an anywidget-based GraphWidget with two-way data sync. 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
    • Icons
    • Pinning
    • On hover tooltip
  • Relationship features:
    • Colors
    • Captions
    • Overlay icons
    • On hover tooltip
  • Graph features:
    • Zooming
    • Panning
    • Moving nodes
    • Using different layouts
    • Clustering nodes by a property
    • Color legend
  • Additional convenience functionality for:
    • Resizing nodes, optionally including scale normalization
    • Coloring nodes based on a property
    • Toggle whether nodes should be pinned or not
    • Setting node icons from a built-in catalog, or from image files, URLs, or a directory
    • Reading the current selection and reacting to click, double-click, and right-click events

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 an IPython.display.HTML object that can be rendered in a Jupyter Notebook or Streamlit application. For an interactive Jupyter widget, use VG.render_widget() instead.

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

Examples

For some Jupyter Notebook and streamlit examples, checkout the /examples directory.

Contributing

If you would like to contribute to this project, please follow our Contributor Guidelines.

About

A Python package for creating interactive graph visualizations

neo4j.com/docs/python-graph-visualization/current/

Topics

anywidgetdata-visualizationgraph-visualizationgraphsjupyter-notebookspythonvisualization

Resources

Readme
License

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

70 stars

Watchers

6 watching

Forks

14 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.