Skip to content

feat!: do not require an Order edge for each nonlocal Ext edge; order_graph computes on demand#2951

Draft
acl-cqc wants to merge 6 commits intoacl/syn_edge_prepfrom
acl/syn_edges
Draft

feat!: do not require an Order edge for each nonlocal Ext edge; order_graph computes on demand#2951
acl-cqc wants to merge 6 commits intoacl/syn_edge_prepfrom
acl/syn_edges

Conversation

@acl-cqc
Copy link
Copy Markdown
Contributor

@acl-cqc acl-cqc commented Mar 16, 2026

Follows #3015; this just

  • Removes validation check that order edges are present (for each nonlocal)
  • Removes builder code that adds order edges (for each nonlocal)
  • Updates spec
  • Actually adds the edges to SynEdgeWrapper

Previous description:

  • Remove the requirement for an Order edge for each Ext edge - validation no longer checks this, and the builder does not add it. (Clients such as guppy will be updated separately).
  • Deprecate the region_portgraph method currently used for (e.g.) topological sorting; this can no longer be relied upon for valid schedules, so really this is a breaking change.
    • TODO: We should deprecate first, and add the new method, in a preliminary non-breaking PR)
  • Add an order_graph method that returns a petgraph (+node map), which includes "synthetic" edges not in the Hugr that express the ordering requirements imposed by the nonlocal edges. (That is, this method scans the relevant region of the Hugr looking for nonlocal edges.)
  • Migrate most uses of region_portgraph, except for SiblingSubgraph, where there is some additional complexity because of traits for convexity checking.
  • TODO: update SiblingSubgraph - we want to do convexity checking on the order graph, but then ignore the synthetic edges for determining the boundary of the SSG, this should allow SSG to be used for more Hugrs than at present.

BREAKING CHANGE: Hugrs are no longer guaranteed to have an Order edge representing the ordering constraint from each nonlocal Ext edge; region_portgraph may return graphs without such edges (use order_graph) - it will return such only if they happen to be present.

@acl-cqc acl-cqc changed the base branch from main to acl/syn_edge_prep April 5, 2026 11:31
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.17%. Comparing base (6db3845) to head (7f5b10a).

Additional details and impacted files
@@                  Coverage Diff                  @@
##           acl/syn_edge_prep    #2951      +/-   ##
=====================================================
- Coverage              81.18%   81.17%   -0.01%     
=====================================================
  Files                    240      240              
  Lines                  44917    44891      -26     
  Branches               38685    38659      -26     
=====================================================
- Hits                   36466    36441      -25     
+ Misses                  6488     6487       -1     
  Partials                1963     1963              
Flag Coverage Δ
python 88.89% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@acl-cqc acl-cqc force-pushed the acl/syn_edge_prep branch from 6db3845 to 521319f Compare April 9, 2026 08:49
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