Skip to main content

No project description provided

Project description

graph_widget

An anywidget implementation of force-graph (https://github.com/vasturiano/force-graph). It includes a brush (Cmd-drag).

Installation

pip install graph_widget

or with uv:

uv add graph_widget

Example

An example marimo script (available as example.py => run with uv run marimo edit example.py):

import graph_widget
import pandas as pd
import json
import requests

url = "https://raw.githubusercontent.com/observablehq/sample-datasets/refs/heads/main/miserables.json"
response = requests.get(url)
data = response.json()

repulsion_slider = mo.ui.slider(
    start=-200, stop=10000, step=10, value=1, debounce=False, label="Repulsion"
)
node_scale_slider = mo.ui.slider(
    start=1, stop=500, step=1, value=20, debounce=True, label="Node scale"
)

data_graph = mo.ui.anywidget(
    graph_widget.ForceGraphWidget(
        data=data,
        repulsion=repulsion_slider.value,
        node_scale=node_scale_slider.value
    )
)

mo.hstack([ data_graph,
            mo.vstack([
                repulsion_slider,
                node_scale_slider])])

selected = data_graph.selected_ids

Development

We recommend using uv for development. It will automatically manage virtual environments and dependencies for you.

uv run marimo edit example.py

Changes made in src/graph_widget/static/ will be reflected in the notebook.

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_widget-0.1.2.tar.gz (186.0 kB view details)

Uploaded Source

Built Distribution

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

graph_widget-0.1.2-py2.py3-none-any.whl (5.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file graph_widget-0.1.2.tar.gz.

File metadata

  • Download URL: graph_widget-0.1.2.tar.gz
  • Upload date:
  • Size: 186.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.13

File hashes

Hashes for graph_widget-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f7fa0cf2577e0830b90b59c624bb5205fb4035799fbb11f7b75fc5648f974cba
MD5 c36398c7a2c8742b5b4fa0b23aca4c04
BLAKE2b-256 23ff5b0317c38a254dc5e62115297c7ec8c3d0aaff8889faf865fdb64460f59d

See more details on using hashes here.

File details

Details for the file graph_widget-0.1.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for graph_widget-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 949ebcd61b9bd7e7fae0a49eb66b84aca643f19b5b808d3376d78f8c668da901
MD5 9298826db354a37018610c288dbe259f
BLAKE2b-256 ff64fda8d69a1f777c5304c6597abe1710a01dfd193b32dd788fad5c5bd95540

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