Skip to content

Phase 8a: spiral-tree flow map (flow_tree) - #27

Merged
schochastics merged 1 commit into
mainfrom
phase-8-flowmap
Jul 24, 2026
Merged

schochastics merged 1 commit into
mainfrom
phase-8-flowmap

Conversation

@schochastics

Copy link
Copy Markdown
Owner

Phase 8, part a (see _docs/REFACTORING-PLAN.md §6/§9). The new, recommended flow map — addressing the maintainer's long-standing dissatisfaction with the TNSS output.

What

  • New export flow_tree(object, xy, root, alpha = 40, n = 20) — a greedy angle-restricted spiral tree (Verbeek, Buchin & Speckmann 2011).
  • Returns per-tree-edge spiral arcs as data.frame(x, y, flow, edge), ready to plot.
  • No interp, no dummy nodes, no triangulation — a single knob alpha (the restricting angle).

Why it's better than TNSS

  • Planar (crossing-free) by construction — the property TNSS can't guarantee.
  • Smooth shallow-angle merges from the logarithmic spirals (bundling is geometric, not a tuned gamma).
  • Node positions fixed (cartographically honest).
  • One intuitive parameter.

Objective validation (on cali2010)

Rather than eyeballing, the tests assert the defining properties:

  • Angle-restriction exact: max segment-to-radial angle = alpha (tested for α = 20/40/60).
  • Planar: 0 crossings between non-adjacent edges (verified α = 20/30/40/45/60 in prototyping; tested at 40).
  • All leaves connected to the root; leaf endpoints fixed at their coordinates; flow positive/finite.

FAIL 0 | WARN 0 | PASS 93.

Notes

  • tnss_*() kept as the legacy alternative (Phase 8c will fix its bugs).
  • Implemented in R (flow-map node counts are small; Rcpp wasn't needed). 8b (TVCG cost-function refinement) is deferred.

🤖 Generated with Claude Code

Add flow_tree(), an angle-restricted greedy spiral tree flow map (Verbeek,
Buchin & Speckmann 2011). Unlike tnss_tree it needs no dummy nodes or
triangulation, keeps the real node positions fixed, produces a planar
(crossing-free) tree with smooth shallow-angle merges, and is tuned by a
single restricting angle `alpha`. Returns per-edge spiral arcs with flow.

Objectively validated on cali2010: the restricting angle holds exactly
(max segment angle = alpha), the tree is planar (no crossings between
non-adjacent edges across a range of alpha), all leaves connect to the
root, and node positions stay fixed. tnss_*() remain as a legacy option.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@schochastics
schochastics merged commit d75b902 into main Jul 24, 2026
@schochastics
schochastics deleted the phase-8-flowmap branch July 24, 2026 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant