-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Bi directional dijkstra #7982
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
Bi directional dijkstra #7982
Conversation
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
graphs/bi_directional_dijkstra.py
Outdated
graph_fwd = { | ||
"B": [["C", 1]], | ||
"C": [["D", 1]], | ||
"D": [["F", 1]], | ||
"E": [["B", 1], ["G", 2]], | ||
"F": [], | ||
"G": [["F", 1]], | ||
} | ||
graph_bwd = { | ||
"B": [["E", 1]], | ||
"C": [["B", 1]], | ||
"D": [["C", 1]], | ||
"F": [["D", 1], ["G", 1]], | ||
"G": [["E", 2]], | ||
} | ||
print( | ||
bidirectional_dij("E", "F", graph_fwd, graph_bwd) | ||
) # # E -- 2 --> G -- 1 --> F == 3 | ||
|
||
if __name__ == "__main__": |
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.
This should be moved within the if name == main
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.
Cannot put graph_fwd
and graph_bwd
inside any other scope because it was giving error in the GitHub workflow while running test
that graph_fwd
is not defined
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.
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.
It has to stay the global scope, I did moved it inside if __name__ == "__main__
and it is working locally but somehow not passing this GitHub workflow
Please fix the checks as well |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
All check blockers are resolved @CaedenPH |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
graph_fwd = { | ||
"B": [["C", 1]], | ||
"C": [["D", 1]], | ||
"D": [["F", 1]], | ||
"E": [["B", 1], ["G", 2]], | ||
"F": [], | ||
"G": [["F", 1]], | ||
} | ||
graph_bwd = { | ||
"B": [["E", 1]], | ||
"C": [["B", 1]], | ||
"D": [["C", 1]], | ||
"F": [["D", 1], ["G", 1]], | ||
"E": [[None, np.inf]], | ||
"G": [["E", 2]], | ||
} |
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.
Move this within the doctest - its why it failed earlier
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
* Added Bi-Directional Dijkstra * Added Bi-Directional Dijkstra * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Added doctest and type hints * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Rename Bi_directional_Dijkstra.py to bi_directional_dijkstra.py * Update bi_directional_dijkstra.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update bi_directional_dijkstra.py * Update bi_directional_dijkstra.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update bi_directional_dijkstra.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update bi_directional_dijkstra.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update bi_directional_dijkstra.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update bi_directional_dijkstra.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update bi_directional_dijkstra.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update bi_directional_dijkstra.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update bi_directional_dijkstra.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update bi_directional_dijkstra.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}
.