Skip to main content

Add your description here

Project description

st-sigma

Streamlit component that allows you visualize interactive graphs using sigma.js.

Installation instructions

Activate your uv venv, then run:

pip install -e .

To build your frontend code, run the following commands from the st_sigma/frontend directory:

npm install
npm run build

To run in development mode with hot-reloading, in the st_sigma/frontend directory, run:

npm install
npm run start

To start your streamlit app, in the st_sigma directory, run:

uv pip install streamlit neo4j
streamlit run example_app.py

Usage instructions

import streamlit as st
from st_sigma import st_sigmagraph, neo4jgraph_to_sigma

import neo4j
from neo4j import GraphDatabase

NEO4J_URI = "bolt://localhost:7677"
NEO4J_USER = "neo4j"
NEO4J_PASSWORD = "your_password"

def query_neo4j_graph(query):
    
    with GraphDatabase.driver(NEO4J_URI, auth=(NEO4J_USER, NEO4J_PASSWORD)) as driver:
        result = driver.execute_query( query, result_transformer_ = neo4j.Result.graph )
        
        return result


query = st.text_area(
    "Enter Cypher Query",
    value="MATCH (n)-[r]->(m) RETURN n, r, m LIMIT 4",
    height=100
)

st.subheader("Component with variable args")


height = st.slider("Graph Height", min_value=200, max_value=800, value=600, step=50)


if st.button("Visualize Graph"):
    try:
        with st.spinner("Querying Neo4j..."):
            result = query_neo4j_graph(query)
            result = neo4jgraph_to_sigma(result)
            
            if not result["nodes"]:
                st.warning("No nodes found in the query result.")
            else:
                st.success(f"Found {len(result['nodes'])} nodes and {len(result['relationships'])} relationships")
                
                st_sigmagraph(
                    graphData=result,
                    height=height,
                    key="neo4j_graph"
                )
    except Exception as e:
        st.error(f"Error: {str(e)}")

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_sigmajs-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

streamlit_sigmajs-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_sigmajs-0.1.0.tar.gz.

File metadata

  • Download URL: streamlit_sigmajs-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for streamlit_sigmajs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 52fcb0552b4a3822382a254cc7d477fb18ade535c7fc9a91d0f367a7782c5699
MD5 fbadfcf6a82cfc4bf531586c308e3c6e
BLAKE2b-256 ecf856f33a9bdf4bbb975cbbd482b28f083adbfad359668ae885c708773d3e42

See more details on using hashes here.

File details

Details for the file streamlit_sigmajs-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_sigmajs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9296dd5c6e4857467455b5455c2acf8e4d135fc0134a66fe0b9969260222a04
MD5 fb3b83c4ef027dbba371b115d565192a
BLAKE2b-256 02df1fbaf1c3e6af46a48eeddb441e05945f7336bba1b43d867a6d2d083866f8

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