gravis
raw JSON → 0.1.0 verified Mon Apr 27 auth: no python
Gravis is an interactive graph visualization library for Python. It generates HTML/CSS/JS visualizations that can be embedded in notebooks or served as standalone web apps. Current version 0.1.0 requires Python >=3.5. Released infrequently.
pip install gravis Common errors
error ModuleNotFoundError: No module named 'gravis' ↓
cause gravis is not installed or installed in a different environment.
fix
Run 'pip install gravis' to install the package.
error AttributeError: module 'gravis' has no attribute 'gv' ↓
cause Incorrect import: using 'import gravis' then 'gravis.gv' which doesn't exist.
fix
Use 'import gravis as gv' then 'gv.d3' or 'gv.vis'.
error TypeError: expected graph object ↓
cause Input to gv.d3 or gv.vis is not a NetworkX graph.
fix
Pass a valid NetworkX graph object (e.g., nx.Graph()).
Warnings
gotcha The 'graph' module (gv.d3 or gv.vis) expects a NetworkX graph. Using other graph types may cause unexpected errors. ↓
fix Ensure input is a NetworkX Graph, DiGraph, etc.
deprecated The old import pattern 'from gravis import gv' does not work. Always use 'import gravis as gv'. ↓
fix Change to 'import gravis as gv'.
Imports
- gv wrong
from gravis import gvcorrectimport gravis as gv - gv.d3 wrong
from gravis import d3correctimport gravis as gv; gv.d3(...) - gv.vis wrong
from gravis import viscorrectimport gravis as gv; gv.vis(...)
Quickstart
import gravis as gv
import networkx as nx
G = nx.Graph()
G.add_edge('a', 'b')
# For Jupyter: use gv.d3(G) or gv.vis(G)
# For standalone web app: gv.d3(G, use_standalone=True)
fig = gv.d3(G)
fig.display()