I’m excited to share with you a new custom component for Streamlit: st-link-analysis, a tool for visualizing and interacting with graphs directly within your Streamlit apps.
Why I created this component
While there are several options available for visualizing graphs, I wanted a more interactive solution that offers the following within the frontend part:
Easily switch to fullscreen mode for a more immersive visualization (especially important for link analysis tasks).
Refresh the layout dynamically without needing to rerun the backend.
View detailed information about nodes and edges directly within the visualization
Exporting data along with positions to JSON.
I plan to continue to work on it every once in while to address any reported issues and add additional features (e.g. hide/show nodes).
You can find the full demo code in the examples directory of the main repository. For instance, the code for the node styles selectbox can be found here.
Yes, of course. Streamlit makes this easy. You can use a text_input field and update the graph data based on its value. Feel free to give it a try, and let me know if you encounter any difficulties.
I’m happy to share some recent updates to the st-link-analysis component. Here’s a quick overview of what’s new and improved:
Key New Features
Node Actions (Expand / Remove)
You can now enable node removal and expansion by passing True to the enable_node_actions parameter. Removal can be triggered by a delete keydown or a remove button click, while expansion occurs on a double-click or expand button click. When these events are triggered, the event details and selected node IDs are sent back to the Streamlit app as the component’s return value.
View Control Bar
A new viewbar frontend component has been added for zooming, fitting, and centering the view, making it easier to navigate your graphs.
Extended Layouts
Added support for fcose and cola cytoscape layouts.
Thanks for this component. Been using it for an analysis and I love how simplified it is. Question. Is there a layout that always shows the graph from Left to right or from Top to bottom, similar to what Graphviz does?
I am using it to analyse business processes and it would be nice to look at a process from either left to right or top to bottom.
HiI’ve been away from the project for the past few months and am just now catching up on the outstanding issues.
If you have feature suggestions or running into any problems using the component please open an issue on the github repo as I’ll be reviewing and prioritizing them soon so I can start addressing them properly.