Spaces:
Running
Running
Delete component/graph_view.py
Browse files- component/graph_view.py +0 -28
component/graph_view.py
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
# Graph view component
|
2 |
-
# File: components/graph_view.py
|
3 |
-
import streamlit as st
|
4 |
-
|
5 |
-
|
6 |
-
def render_graph(graph_data):
|
7 |
-
"""
|
8 |
-
Display a knowledge graph using Streamlit's Graphviz support.
|
9 |
-
Args:
|
10 |
-
graph_data (dict): {
|
11 |
-
'nodes': [{'id': str, 'label': str}],
|
12 |
-
'edges': [{'source': str, 'target': str}]
|
13 |
-
}
|
14 |
-
"""
|
15 |
-
st.header("🔗 Knowledge Graph")
|
16 |
-
if not graph_data or not graph_data.get('nodes'):
|
17 |
-
st.info("No graph data to display.")
|
18 |
-
return
|
19 |
-
|
20 |
-
# Build DOT string
|
21 |
-
dot = "digraph G {\n"
|
22 |
-
for node in graph_data['nodes']:
|
23 |
-
dot += f" {node['id']} [label=\"{node['label']}\"];\n"
|
24 |
-
for edge in graph_data['edges']:
|
25 |
-
dot += f" {edge['source']} -> {edge['target']};\n"
|
26 |
-
dot += "}"
|
27 |
-
|
28 |
-
st.graphviz_chart(dot)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|