[spqr_tree] Per-node planarity testing + virtual-edge skeleton embeddings - #18
Open
devin-ai-integration[bot] wants to merge 7 commits into
Open
[spqr_tree] Per-node planarity testing + virtual-edge skeleton embeddings#18devin-ai-integration[bot] wants to merge 7 commits into
devin-ai-integration[bot] wants to merge 7 commits into
Conversation
Co-Authored-By: Andrew He <he.andrew.mail@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: Andrew He <he.andrew.mail@gmail.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.
Summary
Adds planarity testing and combinatorial embedding to
spqr_tree, computed per SPQR node as each skeleton is sealed (infinalize_node), not as a separate pass.New API:
nodes[n].planar(only R skeletons can fail),blocks[b].planar,is_planar(conjunctions).embed_next: a rotation system over virtual-edge half-edges, node by node — half-edge2*ve+kisvedges[ve]'s endpoint atvs[k],embed_next[h]is the next half-edge around that skeleton vertex. Glue across nodes viavedges[ve].o_ve(R rotations unique up to reflection, P freely permutable, S/Q/I/O rigid).How: each sealed vedge range is already a DFS of the node's skeleton (every tree vedge appears after its whole subtree; every vedge is a collapsed 2-attachment component, so it acts as a single tree/back edge).
emit_node_embeddinghandles Q/I/O/S/P trivially;emit_rigiddoes four passes over the range: index skeleton vertices → recompute skeleton lowpoints bottom-up + re-sort each vertex's outgoing vedges by skeleton nesting depth (collapsing a subtree can change its lowpt/chordality, so the original bucket-sorted order is not a valid nesting order — this was verified empirically) → Brandes' left-right test on the skeleton (conflict-pair stack, implicit two-coloring vialr_ref/lr_side) → sign resolution + rotation emission. A non-planar R skeleton only clears its own flag and falls back to an arbitrary (still circular) rotation; the rest of the block is unaffected.Design notes in
doc/spqr_planarity.md.Validation
V - E + F == 2, i.e. genus 0) pass under ASan/UBSan, including 4000 extra random multigraphs up to 60 vertices / 140 edges.is_planarmatches networkx on 60,000 random multigraphs.Link to Devin session: https://app.devin.ai/sessions/8d675c3c6ba24d019643c3fabdd14e23
Requested by: @ecnerwala