Skip to content

feat: PersistentHugr implements HugrView #2202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

lmondada
Copy link
Contributor

Closes #2095

@lmondada lmondada requested a review from a team as a code owner May 12, 2025 14:42
@lmondada lmondada requested review from zrho and aborgna-q and removed request for a team and zrho May 12, 2025 14:42
Copy link

codecov bot commented May 12, 2025

Codecov Report

Attention: Patch coverage is 84.78605% with 96 lines in your changes missing coverage. Please review.

Project coverage is 82.24%. Comparing base (1771404) to head (08e3eb0).

Files with missing lines Patch % Lines
hugr-core/src/hugr/persistent/trait_impls.rs 77.25% 48 Missing and 5 partials ⚠️
hugr-core/src/hugr/persistent/state_space.rs 82.48% 23 Missing and 1 partial ⚠️
hugr-core/src/hugr/internal.rs 0.00% 9 Missing ⚠️
hugr-core/src/hugr/persistent.rs 96.65% 3 Missing and 4 partials ⚠️
hugr-core/src/hugr/patch/simple_replace.rs 90.90% 3 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                   @@
##           feat/persistenthugr    #2202      +/-   ##
=======================================================
+ Coverage                82.14%   82.24%   +0.09%     
=======================================================
  Files                      234      235       +1     
  Lines                    41393    41984     +591     
  Branches                 37492    38083     +591     
=======================================================
+ Hits                     34004    34528     +524     
- Misses                    5422     5479      +57     
- Partials                  1967     1977      +10     
Flag Coverage Δ
python 85.64% <ø> (ø)
rust 81.89% <84.78%> (+0.10%) ⬆️

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.

@@ -93,6 +93,22 @@ impl<N: HugrNode> OutputBoundaryMap<N> {
.into_iter()
}

/// The keys of the map.
///
/// These will be either outgoing or incoming ports, depending on the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me wonder - is this really an OutputBoundaryMap, rather than just a BoundaryMap?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was deleted by the SimpleReplacement simplification PR (#2208)

Comment on lines +102 to +107
fn from_portgraph(&self, node: portgraph::NodeIndex) -> N {
let node = node.into();
self.iter()
.find_map(|(&k, &v)| (v == node).then_some(k))
.expect("Portgraph node not found in map")
}
Copy link
Collaborator

@aborgna-q aborgna-q May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we fine with doing a linear search here?
Do you think it's not worth it having a pair of maps instead?

Base automatically changed from feat/persistenthugr to main May 14, 2025 19:04
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.

3 participants