https://github.com/q-maze/streamlit-vis-network
Streamlit component that allows you to visualize networks using vis.js
https://github.com/q-maze/streamlit-vis-network
graphs streamlit streamlit-component visualization
Last synced: 4 months ago
JSON representation
Streamlit component that allows you to visualize networks using vis.js
- Host: GitHub
- URL: https://github.com/q-maze/streamlit-vis-network
- Owner: q-maze
- License: mit
- Created: 2025-01-13T17:54:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-19T14:06:17.000Z (over 1 year ago)
- Last Synced: 2025-09-07T11:57:53.298Z (10 months ago)
- Topics: graphs, streamlit, streamlit-component, visualization
- Language: Python
- Homepage:
- Size: 2.09 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# streamlit-vis-network
Streamlit component that allows you to visualize networks using vis.js
## Installation instructions
```sh
pip install streamlit-vis-network
```
## Usage instructions
```python
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
