A streamlit custom component for visualizing and interacting with graphs
Project description
st-link-analysis
A custom Streamlit component for link analysis, built with Cytoscape.js and Streamlit.
Overview
This project provides a Streamlit custom component for visualizing and interacting with graph data using Cytoscape.js. It supports customizable edge and node styles, labels, colors, captions, and icons.
Demo
WIP
Features
- Customizable Node and Edge Styles: Easily define the appearance of nodes and edges using a variety of style options.
- Material Icons Support: Supports a subset of Material icons for styling nodes which can be passed by name (e.g.,
icon='person'
). Arbitrary icons can still be used by passing a url (icon='url(...)'
). - Customizable Layouts: Choose from different layout algorithms to arrange the graph elements. Currently only Cytoscape JS base layouts are supported.
- Interactive Features:
- Fullscreen button.
- JSON export button.
- Layout refresh button.
- Highlights neighboring nodes or edges when an element is selected.
- View all properties of the selected elements in a sidebar.
Installation
To install the package, use pip:
pip install st-link-analysis
Usage
Here is a basic example of how to use the component in your Streamlit app:
import streamlit as st
from st_link_analysis import st_link_analysis
# Sample data
elements = [
{'data': {'id': 'A', 'label': 'Node A'}},
{'data': {'id': 'B', 'label': 'Node B'}},
{'data': {'source': 'A', 'target': 'B', 'label': 'Edge from A to B'}}
]
# Create the component
MyStreamlitComponent(elements=elements, height=500)
API Reference
Element | Description |
---|---|
NodeStyle |
Defines styles for nodes, including labels, colors, captions, and icons. Refer to docstring. |
EdgeStyle |
Defines styles for edges, including curve styles, labels, colors, and directionality. Refer to docstring. |
st_link_analysis |
Main component for creating and displaying the graph, including layout and height settings. Refer to docstring. |
Development
WIP
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Acknowledgments
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
Hashes for st_link_analysis-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67fc5dd7e9d37da138e69d3c8f28486f4956607e3a92d410fa9dad95d8fdc5aa |
|
MD5 | 890a631a941e0d443c61446a86a17a6c |
|
BLAKE2b-256 | d685520b10f960a18e61587e147180ef000b7a96b550a4eb46f48ad0c34af4ca |