Optimal Pedagogical Stack — K5 hard case, 3 treatments

Cùng K5 hard case từ các demo trước (5 nodes R=78, 10 edges multi-char). Progression: (1) current v1.2 = rotated pills + greedy cascade, (2) drop rotation → axis-aligned + greedy, (3) full optimal = axis + simulated-annealing (400 iter) + leader-first fallback + typography hierarchy + pill tint theo source node.

Recommendation

  1. Layout-first: nếu graph là DAG → Dagre/Sugiyama layered (K5 không phải DAG nên bỏ qua). Layout chọn trước = root-cause fix cho pill density.
  2. Axis-aligned pill: text stays horizontal. Reader không nghiêng đầu. Trade off: mất pill-ôm-edge visual. Win: clarity.
  3. Leader line first-class: collision > threshold → external callout with dashed leader. Never silent fallback.
  4. Global pass (SA/force-directed): greedy cascade chỉ hit local min. SA 100–200 iter converge tốt hơn.
  5. Typography hierarchy: primary value bold, secondary dim. Color-code pill bg theo source node.