-
-
Notifications
You must be signed in to change notification settings - Fork 46.6k
Add 0-1-bfs. #3285
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 0-1-bfs. #3285
Conversation
@cclauss, I see there are a lot of new PRs coming. But any updates on this one? Does this algo look fine for this repo or should I come with another one? |
return self._size | ||
|
||
def add_edge(self, from_vertex: int, to_vertex: int, weight: int): | ||
self._graph[from_vertex].append(Edge(to_vertex, weight)) |
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.
We do not check if we have gone beyond size?
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.
Yep, added that.
* Add 0-1-bfs. * fixup! Add 0-1-bfs. * fixup! Add 0-1-bfs. * Check edge weights. * Check edge vertecies.
* Add 0-1-bfs. * fixup! Add 0-1-bfs. * fixup! Add 0-1-bfs. * Check edge weights. * Check edge vertecies.
* Add 0-1-bfs. * fixup! Add 0-1-bfs. * fixup! Add 0-1-bfs. * Check edge weights. * Check edge vertecies.
* Add 0-1-bfs. * fixup! Add 0-1-bfs. * fixup! Add 0-1-bfs. * Check edge weights. * Check edge vertecies.
Add 0-1-bfs**
Finding the shortest path in 0-1-graph in O(E + V) which is faster than dijkstra.
0-1-graph is the weighted graph with the weights equal to 0 or 1.
Link: https://codeforces.com/blog/entry/22276
Checklist:
Fixes: #{$ISSUE_NO}
.