Skip to main content

Network graph visualization in Streamlit using vis.js

Project description

streamlit-vis-network

Streamlit component that allows you to visualize networks using vis.js

Installation instructions

pip install streamlit-vis-network

Usage instructions

import streamlit as st
from streamlit_vis_network import streamlit_vis_network

# define nodes and edges as python dicts
nodes = [{'id': 1, "label": "node 1"}, {'id': 2, "label": "node 2"}]
edges = [{"from": 1, "to": 2, "label": "edge", "id": "edge1"}]

# pass nodes and edges to component constructor
selection = streamlit_vis_network(nodes, edges, height=500, width=500)

# display selected node/edge
if selection:
    selected_nodes, selected_edges, positions = selection
    if selected_nodes:
        st.write(f"Selected node: {selected_nodes[0]}")
    elif selected_edges:
        st.write(f"Selected edge: {selected_edges[0]}")
    else:
        st.write("No current selection.")
else:
    st.write("No current selection.")

# show node positions
if st.toggle(label="Show Node Positions") and selection:
    st.write("Node Positions")
    st.write(positions)

Demo

til

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

streamlit_vis_network-0.1.3.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

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

streamlit_vis_network-0.1.3-py3-none-any.whl (2.1 MB view details)

Uploaded Python 3

File details

Details for the file streamlit_vis_network-0.1.3.tar.gz.

File metadata

  • Download URL: streamlit_vis_network-0.1.3.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for streamlit_vis_network-0.1.3.tar.gz
Algorithm Hash digest
SHA256 1b3c493c6ce261a85b231b09c4134fddd498435b07d2e62b58695272a989924f
MD5 62805015c79a46f69071d5a5a89e1b85
BLAKE2b-256 8161f95c7dd128d430d28bdea2864dbedb720d06af5f4ce7ab5370bb5fcba329

See more details on using hashes here.

File details

Details for the file streamlit_vis_network-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_vis_network-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 02354652b1e7130b19d3d85b4db6f86791494de0ec434bfef0f4cd2efce99ffd
MD5 bdb113d220dc4d73a13a45df5b7c3319
BLAKE2b-256 23c380d05320d96097baec5054915f0baddea889433aec9c85a226bf4b2e099e

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