prakharg24 commited on
Commit
0be3098
·
verified ·
1 Parent(s): 68f8531

Update my_pages/multiverse.py

Browse files
Files changed (1) hide show
  1. my_pages/multiverse.py +4 -3
my_pages/multiverse.py CHANGED
@@ -23,7 +23,7 @@ choices_list = [
23
  ]}
24
  ]
25
 
26
- def build_tree_and_trace_path(selected_path, spread_factor=5000):
27
  """
28
  Build tree nodes and edges. Then trace selected_path (one choice per stage)
29
  by walking children of the current node to find the matching label at each stage.
@@ -40,6 +40,7 @@ def build_tree_and_trace_path(selected_path, spread_factor=5000):
40
  -------
41
  node_labels, node_positions, edges, highlight_edges, highlight_nodes
42
  """
 
43
  node_labels = ["Start"]
44
  node_positions = [(0.0, 0.0)]
45
  node_stage = [0]
@@ -54,7 +55,7 @@ def build_tree_and_trace_path(selected_path, spread_factor=5000):
54
  next_nodes = []
55
 
56
  # scaling: huge spread at stage 1, tapering off deeper
57
- scale = spread_factor ** (1.0 / stage_idx**(0.5))
58
 
59
  for parent_order, parent_idx in enumerate(prev_nodes):
60
  px, py = node_positions[parent_idx]
@@ -172,7 +173,7 @@ def render():
172
  # max y among these nodes
173
  max_y = max(positions[i][1] for i in stage_nodes)
174
  x = float(stage_idx)
175
- y = max_y + 0.5 * 5000 # offset above top node
176
  stage_label_traces.append(go.Scatter(
177
  x=[x], y=[y],
178
  text=[stage["label"]],
 
23
  ]}
24
  ]
25
 
26
+ def build_tree_and_trace_path(selected_path, spread_factor=10000):
27
  """
28
  Build tree nodes and edges. Then trace selected_path (one choice per stage)
29
  by walking children of the current node to find the matching label at each stage.
 
40
  -------
41
  node_labels, node_positions, edges, highlight_edges, highlight_nodes
42
  """
43
+
44
  node_labels = ["Start"]
45
  node_positions = [(0.0, 0.0)]
46
  node_stage = [0]
 
55
  next_nodes = []
56
 
57
  # scaling: huge spread at stage 1, tapering off deeper
58
+ scale = spread_factor ** (1.0 / stage_idx**(0.2))
59
 
60
  for parent_order, parent_idx in enumerate(prev_nodes):
61
  px, py = node_positions[parent_idx]
 
173
  # max y among these nodes
174
  max_y = max(positions[i][1] for i in stage_nodes)
175
  x = float(stage_idx)
176
+ y = max_y + 0.5 * 10000 # offset above top node
177
  stage_label_traces.append(go.Scatter(
178
  x=[x], y=[y],
179
  text=[stage["label"]],