-
Notifications
You must be signed in to change notification settings - Fork 147
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
Add bfs-search #469
Add bfs-search #469
Conversation
This commit implements a `breadth_first_search` that provides the ability to insert callback functions at specified event points. Python users should subclass `retworkx.visit.BFSVisitor` and overwrite the appropriate callback functions. Similar to Qiskit#456
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.
Overall this LGTM I'm looking forward to getting this and the dfs in retworkx. I just have a few questions and suggestions inline.
Also, sorry this has taken me so long to look at, I've been heads down on some qiskit-terra functionality and haven't had much time for retworkx reviews.
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Pull Request Test Coverage Report for Build 1472802387
💛 - Coveralls |
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.
Thanks for the fast updates, I think this is basically ready now. Before approving I just have one inline question/comment before I'm ready to approve.
Also I was looking at coverage and I noticed a bunch of continue lines don't have coverage, for example: https://coveralls.io/builds/44296139/source?filename=retworkx-core%2Fsrc%2Ftraversal%2Fbfs_visit.rs#L247 is that an issue with the coverage collection or are we missing a path in the tests so that's not getting triggered.
Yeah, we miss some test paths, let me add some extra tests to cover these lines. |
@mtreinish |
I think having a test case that just runs like normal when |
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.
LGTM thanks for updating this. The dispatch function is just missing the example from it's docstring after that's added I think this is ready to merge.
In the following example we keep track of the tree edges: | ||
|
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.
The example here is missing
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.
Oops, good catch! Added in e6123aa.
* Add bfs-search This commit implements a `breadth_first_search` that provides the ability to insert callback functions at specified event points. Python users should subclass `retworkx.visit.BFSVisitor` and overwrite the appropriate callback functions. Similar to Qiskit#456 * update docs from code review Co-authored-by: Matthew Treinish <mtreinish@kortar.org> * docs Co-authored-by: Matthew Treinish <mtreinish@kortar.org> * docs + a comment in the code * pseudo-code is not a doc test * fix typo in docs * do not raise if StopSearch exception * more tests * black * add missing example from docs * black again Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
This commit implements a
breadth_first_search
that providesthe ability to insert callback functions at specified event points.
Python users should subclass
retworkx.visit.BFSVisitor
and overwritethe appropriate callback functions.
Similar to #456