Graph editor for Jupyter
Project description
Interactive Graph Editor for Jupyter
An interactive graph editor function designed for Jupyter notebooks. edit(graph: nx.Graph) function allows users
to manipulate a graph by creating vertices, edges, and adding labels directly within a Jupyter environment.
Parameters
- graph (networkx.Graph): The graph object to be edited. It should be an instance of the NetworkX Graph class or a subclass.
- color_dict (Dict[str, str]): Map of color labels into HTML colors, empty by default.
Functions of buttons (from left to right)
- Select if you want to edit graph structure.
- Select if you want to edit labels.
- Select if you want for nodes to be clickable. Deselecting this should make it easier to operate on edges in a large graph.
- Select if you want for edges to be clickable. Deselecting this should make it easier to operate on nodes in a large graph.
- Turn on/off physics.
- Turn on/off fancy drawing (planar representation of a graph, works only for 3-connected planar graphs).
- Enable/disable labels.
- Exit the editor.
Mouse Functions
- Click and drag vertices to move them around the canvas.
- To create an edge, click on one vertex and then click on another vertex.
An edge will be created between the two selected vertices. - To create a vertex, click on empty space on the canvas.
- To delete an object, double-click on it.
Dependencies
- Jupyter notebook web environment.
- NetworkX library for graph manipulation.
Notes
This function relies on Jupyter ipywidgets, so it should work only in web versions of Jupyter. (It is possible to run editor in VSCode but it is not guaranteed that it will work properly or even run at all.)
Installation instructions
go to: https://pypi.org/project/graph-editor-jupyter/
or run:
pip install graph-editor-jupyter
Examples
import networkx as nx
from graph_editor_jupyter import edit
# Create a sample graph
G = nx.Graph()
G.add_nodes_from([1, 2, 3])
G.add_edges_from([(1, 2), (2, 3)])
# Call the interactive graph editor
edit(G)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file graph_editor_jupyter-0.0.5.tar.gz.
File metadata
- Download URL: graph_editor_jupyter-0.0.5.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db6d87db27e125b5d9ac96724b1401163de690fcb4361a4c6d4da5d3b28041b6
|
|
| MD5 |
3a78bbf012cfde60acee2b1603c2cba1
|
|
| BLAKE2b-256 |
4497b28714d64277645f2ea4b3f751e7058cced5178c72952fcf21945b95bf5b
|
File details
Details for the file graph_editor_jupyter-0.0.5-py3-none-any.whl.
File metadata
- Download URL: graph_editor_jupyter-0.0.5-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3626d416c7b4fbb73e1ef88eb267cb989e8f9bbf4500fa2557b09ae9cc2dbd83
|
|
| MD5 |
0f003b0705a70e4b8dc33e484f3b35cc
|
|
| BLAKE2b-256 |
0d867471d977f05f52da946d456b4b0ba110f461a8b063993df9036b942eb386
|