Skip to content
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

Generalise toposort to LinkView #96

Merged
merged 7 commits into from
Jul 28, 2023
Merged

Generalise toposort to LinkView #96

merged 7 commits into from
Jul 28, 2023

Conversation

lmondada
Copy link
Contributor

No description provided.

@lmondada lmondada requested a review from aborgna-q July 28, 2023 06:41
@lmondada lmondada marked this pull request as draft July 28, 2023 06:42
@lmondada
Copy link
Contributor Author

Sorry, messed up my git manip, will be ready soon!

@lmondada lmondada marked this pull request as ready for review July 28, 2023 06:58
@lmondada
Copy link
Contributor Author

It's ready now!

@lmondada
Copy link
Contributor Author

Side note: this could also be implemented on any petgraph, but thought that it would be odd to have a petgraph-only algo in portgraph, so I prefered the LinkView-implementation.

@lmondada lmondada force-pushed the feature/topsort-linkview branch from 8ec7c84 to 8241d74 Compare July 28, 2023 07:19
@lmondada lmondada force-pushed the feature/topsort-linkview branch from 8241d74 to 38d02f5 Compare July 28, 2023 07:29
@lmondada lmondada mentioned this pull request Jul 28, 2023
Copy link
Collaborator

@aborgna-q aborgna-q left a comment

Choose a reason for hiding this comment

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

Nice!

Petgraph already has a toposort algo. There's a benchmark here that compares both implementations (and petgraph's was faster last time I checked!)
image

That implementation allocates a vector with the result instead of returning the iterator. We currently use petgraph's in Hugr, but imho both are useful.

@lmondada lmondada merged commit 32ea9f6 into main Jul 28, 2023
@lmondada lmondada deleted the feature/topsort-linkview branch July 28, 2023 10:50
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.

2 participants