Skip to content
/ netvis Public

NetVis is a package for interactive visualization Python NetworkX graphs within Jupyter Lab. It leverages D3.js for dynamic rendering and supports HTML export, making network analysis effortless.

License

Notifications You must be signed in to change notification settings

cmscom/netvis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

netvis

NetVis is a package for interactive visualization of Python NetworkX graphs within JupyterLab. It leverages D3.js for dynamic rendering and supports HTML export, making network analysis effortless.

Version 0.4.0 introduces a MIME renderer architecture that simplifies installation and improves compatibility with modern JupyterLab environments.

Installation

You can install using pip:

pip install net_vis

Note for version 0.4.0+: The nbextension is no longer required. NetVis now uses a MIME renderer that works automatically in JupyterLab 3.x and 4.x environments.

Quick Start

This section provides a simple guide to get started with the project using JupyterLab.

Example

import net_vis

data = """
{
  "nodes": [
    {
      "id": "Network"
    },
    {
      "id": "Graph"
    }
  ],
  "links": [
    {
      "source": "Network",
      "target": "Graph"
    }
  ]
}
"""

w = net_vis.NetVis(value=data)
w

When executed, an interactive D3.js force-directed graph is displayed.

  • Display Sample

Desplay Sample

JpyterLab Sample

Development Installation

Create a dev environment:

python -m venv venv-netvis
source venv-netvis/bin/activate

Install the Python package. This will also build the TypeScript package:

pip install -e ".[test, examples, docs]"

Install JavaScript dependencies and build the extension:

yarn install
jupyter labextension develop --overwrite .
yarn run build

Note: As of version 0.4.0, nbextension support has been removed. NetVis now exclusively uses the MIME renderer architecture for JupyterLab 3.x and 4.x.

How to see your changes

TypeScript:

If you use JupyterLab to develop, you can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.

# Watch the source directory in one terminal, automatically rebuilding when needed
yarn run watch
# Run JupyterLab in another terminal
jupyter lab

After a change, wait for the build to finish and then refresh your browser and the changes should take effect.

Python:

If you make a change to the Python code, you will need to restart the notebook kernel to have it take effect.

Contributing

Contributions are welcome!
For details on how to contribute, please refer to CONTRIBUTING.md.

Special Thanks

This project was initiated on the proposal of Shingo Tsuji. His invaluable contributions —from conceptual planning to requirements definition— have been instrumental in bringing this project to fruition. We extend our deepest gratitude for his vision and support.

About

NetVis is a package for interactive visualization Python NetworkX graphs within Jupyter Lab. It leverages D3.js for dynamic rendering and supports HTML export, making network analysis effortless.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published