-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix: Hierarchy descendants return root siblings #178
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #178 +/- ##
=======================================
Coverage 83.27% 83.27%
=======================================
Files 24 24
Lines 6104 6117 +13
Branches 6104 6117 +13
=======================================
+ Hits 5083 5094 +11
- Misses 945 947 +2
Partials 76 76 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest you turn child_queue
and root
into a sum type, but if you think it's more hassle than it's worth, then this is fine by me.
@@ -635,6 +636,8 @@ pub struct Descendants<'a> { | |||
/// For each region, we point to a child node that has not been visited yet. | |||
/// When a region is visited, we move to the next child node and queue its children region at the end of the queue. | |||
child_queue: VecDeque<NodeIndex>, | |||
/// The root node we are iterating over. | |||
root: NodeIndex, | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I let you be the judge of whether this is worth it, but in principle I'd much prefer something like:
enum NextStates {
Root(NodeIndex),
Children(VecDeque<NodeIndex>),
}
pub struct Descendants<'a> {
/// The hierarchy this iterator is iterating over.
layout: &'a Hierarchy,
/// A queue of regions to visit.
///
/// For each region, we point to a child node that has not been visited yet.
/// When a region is visited, we move to the next child node and queue its children region at the end of the queue.
next_states: NextStates,
}
It would make it clearer what the purpose of each field is, and will also make the Default
implementation more sane.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, makes sense.
## 🤖 New release * `portgraph`: 0.13.0 -> 0.13.1 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.13.1](v0.13.0...v0.13.1) - 2025-01-20 ### Bug Fixes - Mermaid render of graph views was empty (#175) - Hierarchy descendants return root siblings (#178) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/).
#753) Currently waiting for the package releases. Requires the fix in CQCL/portgraph#178. BREAKING CHANGE: Bumped `hugr` dependency to `0.15` --------- Co-authored-by: Douglas Wilson <[email protected]> Co-authored-by: Douglas Wilson <[email protected]>
Closes #177