Repository navigation
MINGLE: O(E log E) via vendored nanoflann kd-tree - #26
Merged
Merged
Conversation
Build the kNN proximity graph over edges once with a kd-tree (vendored header-only nanoflann, BSD) instead of scanning all pairs, then coarsen that candidate graph combinatorially level by level. Adds a `k` parameter (merge candidates per edge). With k >= edge count the merges are identical to the previous exhaustive search, so behaviour on small graphs is unchanged; large graphs now scale near-linearly. nanoflann's copyright holder added to Authors@R (cph); its BSD license header is retained in src/nanoflann.hpp. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to Phase 6 (#24): make MINGLE scale near-linearly, as the paper intends.
What
src/nanoflann.hpp— a header-only kd-tree (nanoflann 1.10.1, BSD). No DESCRIPTION dependency (LinkingTonot needed; it's a self-contained header). Copyright holder added toAuthors@Rascph; the BSD header is kept intact.mingle_iterrewritten: build the kNN proximity graph over the edges (points in canonical 4-D endpoint space) once with the kd-tree, then coarsen that candidate graph combinatorially each level — instead of the previous O(E²) all-pairs rescan per level. Overall O(E log E).kargument onedge_bundle_mingle()(merge candidates per edge, default 10).Behaviour preservation
The merge criterion is unchanged (nearest candidate by meeting-point distance → greedy ink-reducing match). With
k≥ edge count the candidate graph is complete, so merges are identical to the exhaustive version — the Phase-6 tests pass unchanged (small-graph mid-spread still 0.5).Verification
FAIL 0 | PASS 82.k=3andk=allboth run and produce finite output.🤖 Generated with Claude Code