-
-
Notifications
You must be signed in to change notification settings - Fork 46.1k
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 doctests for graphs_floyd_warshall.py #12436
base: master
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Added doc tests, contributes to resolving the issue #9943 |
@poyea Hi. I just added some tests to improve the coverage. Could you check it pls? Thank you |
@cclauss Hi. I added some tests to improve the coverage. Could you please check it? Thank you. |
Co-authored-by: Christian Clauss <[email protected]>
for more information, see https://pre-commit.ci
# 1. For all edges from v to n, distance[i][j] = weight(edge(i, j)). | ||
|
||
# 2. distance[i][j] = min(distance[i][j], distance[i][k] + distance[k][j]). | ||
|
||
# 3. Step 2 is true for each pair of vertices.Repeat for k vertex in the graph. | ||
|
||
# 4. Whenever distance[i][j] is given a new minimum value, | ||
# next vertex[i][j] = next vertex[i][k]. |
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 algorithm explanation should be moved into the docstring at the top of the file
|
||
_print_dist(dist, v) | ||
return dist, v | ||
return dist, vertex |
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.
Is vertex
just the input parameter vertex
? If this variable isn't being modified in the function, then there's no need to return it again because we already know what the value is.
@@ -1,62 +1,112 @@ | |||
# floyd_warshall.py |
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.
# floyd_warshall.py |
I'm not sure why this comment is here
Describe your change:
Contributes to #9943
Added Doc tests
Added algorithm
Added type hints
Modified the function to return result
Checklist: