Skip to main content

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)

  1. Select if you want to edit graph structure.
  2. Select if you want to edit labels.
  3. Select if you want for nodes to be clickable. Deselecting this should make it easier to operate on edges in a large graph.
  4. Select if you want for edges to be clickable. Deselecting this should make it easier to operate on nodes in a large graph.
  5. Turn on/off physics.
  6. Turn on/off fancy drawing (planar representation of a graph, works only for 3-connected planar graphs).
  7. Enable/disable labels.
  8. Exit the editor.

Mouse Functions

  1. Click and drag vertices to move them around the canvas.
  2. To create an edge, click on one vertex and then click on another vertex.
    An edge will be created between the two selected vertices.
  3. To create a vertex, click on empty space on the canvas.
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graph_editor_jupyter-0.0.5.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graph_editor_jupyter-0.0.5-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

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

Hashes for graph_editor_jupyter-0.0.5.tar.gz
Algorithm Hash digest
SHA256 db6d87db27e125b5d9ac96724b1401163de690fcb4361a4c6d4da5d3b28041b6
MD5 3a78bbf012cfde60acee2b1603c2cba1
BLAKE2b-256 4497b28714d64277645f2ea4b3f751e7058cced5178c72952fcf21945b95bf5b

See more details on using hashes here.

File details

Details for the file graph_editor_jupyter-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for graph_editor_jupyter-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3626d416c7b4fbb73e1ef88eb267cb989e8f9bbf4500fa2557b09ae9cc2dbd83
MD5 0f003b0705a70e4b8dc33e484f3b35cc
BLAKE2b-256 0d867471d977f05f52da946d456b4b0ba110f461a8b063993df9036b942eb386

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page