### Install st-cytoscape Component (Bash) Source: https://github.com/vivien000/st-cytoscape/blob/master/README.md Provides the command to install the st-cytoscape Streamlit component using pip. This is the first step to use the library. ```Bash pip install st-cytoscape ``` -------------------------------- ### Use Klay Layout (Python) Source: https://github.com/vivien000/st-cytoscape/blob/master/README.md Provides a simple example of how to specify the klay layout option for the graph using the cytoscape-klay extension. ```Python layout = {"name": "klay"} ``` -------------------------------- ### Apply fCoSE Layout Constraints (Python) Source: https://github.com/vivien000/st-cytoscape/blob/master/README.md Shows examples of how to define and apply placement constraints (horizontal alignment, relative placement) when using the fcose layout option in st-cytoscape. Requires the fcose layout to be specified. ```Python layout = {"name": "fcose", "animationDuration": 0} layout["alignmentConstraint"] = {"horizontal": [["X", "Y"]]} layout["relativePlacementConstraint"] = [{"top": "Z", "bottom": "X"}] layout["relativePlacementConstraint"] = [{"left": "X", "right": "Y"}] ``` -------------------------------- ### Embed Cytoscape Graph in Streamlit (Python) Source: https://github.com/vivien000/st-cytoscape/blob/master/README.md Demonstrates how to use the st_cytoscape.cytoscape function to embed a graph in a Streamlit app. It shows how to define graph elements, stylesheet, and retrieve selected nodes/edges. Requires streamlit and st-cytoscape. ```Python import streamlit as st from st_cytoscape import cytoscape elements = [ {"data": {"id": "X"}, "selected": True, "selectable": False}, {"data": {"id": "Y"}}, {"data": {"id": "Z"}}, {"data": {"source": "X", "target": "Y", "id": "X➞Y"}}, {"data": {"source": "Z", "target": "Y", "id": "Z➞Y"}}, {"data": {"source": "Z", "target": "X", "id": "Z➞X"}}, ] stylesheet = [ {"selector": "node", "style": {"label": "data(id)", "width": 20, "height": 20}}, { "selector": "edge", "style": { "width": 3, "curve-style": "bezier", "target-arrow-shape": "triangle" } } ] selected = cytoscape(elements, stylesheet, key="graph") st.markdown("**Selected nodes**: %s" % (", ".join(selected["nodes"]))) st.markdown("**Selected edges**: %s" % (", ".join(selected["edges"]))) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.