Add Backman partial-orientation utilities and rank heuristics#35
Open
Copilot wants to merge 2 commits into
Open
Add Backman partial-orientation utilities and rank heuristics#35Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Agent-Logs-Url: https://github.com/DhyeyMavani2003/chipfiring/sessions/2b791a11-517f-46c4-b865-10113361d42c Co-authored-by: DhyeyMavani2003 <82772894+DhyeyMavani2003@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add partial orientations and rank related optimizations
Add Backman partial-orientation utilities and rank heuristics
Apr 21, 2026
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.
Implements primitives and rank-search shortcuts motivated by Spencer Backman's Riemann–Roch theory for graph orientations (arXiv:1401.3309).
CFOrientation— partial-orientation APIis_partial(),oriented_edge_count(),unoriented_edge_count()sources()/sinks()— vertices withindeg_O = 0/outdeg_O = 0is_acyclic()— iterative three-color DFS over the directed sub-orientation; unoriented edges are ignored, matching Backman's definition for partial orientationspartial_divisor()— Backman'sD_O(v) = indeg_O(v) − 1; matchesdivisor()on full orientations but does not require fullnessCFRank— newoptimized=Trueshortcutsdeg(D) < 0 ⇒ rank = −1, skipping the EWD calldeg(D) − g ≥ 1, start the search atk = deg(D) − g + 1sincer(D) ≥ deg(D) − gguaranteesD − Eis winnable for all smallerk. Gated so the pre-existingK − Dswap heuristic is exercised only when this bound is not useful (no behavior change on that path).Tests
11 new tests in
tests/test_cforientation.pyandtests/test_cfrank.pycovering each new method and both new optimizations.