-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbokeh_app_simple.py
More file actions
56 lines (43 loc) · 1.44 KB
/
bokeh_app_simple.py
File metadata and controls
56 lines (43 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python
"""
Simple Bokeh app to test edge rendering.
"""
import sys
import os
sys.path.append(os.path.dirname(__file__))
from bokeh.io import curdoc
from bokeh.layouts import column
from bokeh.models import Div
from bokeh.plotting import figure
from src.wolfram_physics.hypergraph_processor import HypergraphProcessor
from src.wolfram_physics.rule_engine import WolframRuleEngine
from src.wolfram_physics.interactive_visualizer import InteractiveVisualizer
def create_simple_app():
"""Create a simple test app."""
# Header
header = Div(text="<h1>Simple Hypergraph Visualization</h1>")
# Create triangle hypergraph
processor = HypergraphProcessor({
'e1': ['A', 'B'],
'e2': ['B', 'C'],
'e3': ['A', 'C']
})
engine = WolframRuleEngine()
# Create visualizer
visualizer = InteractiveVisualizer(processor, engine)
# Create the main plot
plot = visualizer.create_main_plot(width=600, height=600)
# Info
info = Div(text=f"""
<p><b>Hypergraph Info:</b><br>
Nodes: {list(processor.nodes)}<br>
Edges: {dict(processor.edges)}<br>
<br>
<b>Note:</b> Arrows show direction from first to second node in each edge.<br>
Edge directions: A→B, B→C, A→C<br>
</p>
""")
return column(header, plot, info)
# Create document
curdoc().title = "Simple Hypergraph Test"
curdoc().add_root(create_simple_app())