Repository navigation
graphs/kruskal: add a test case to verify the correctness, fix styles - #2443
Conversation
…the algorithm Fixes #2128
| [3, 5, 14], | ||
| [3, 4, 9], | ||
| [5, 4, 10], | ||
| [1, 7, 11]] |
There was a problem hiding this comment.
psf/black will reformat the matrices.
Co-authored-by: Christian Clauss <cclauss@me.com>
Travis tests have failedHey @meysam81, TravisBuddy Request Identifier: 327c6100-095e-11eb-b9d6-41d4da7e5060 |
poyea
left a comment
There was a problem hiding this comment.
Thank you for your pull request!🤩
|
No type hints or doctests. |
|
Right we can add some type hints to this file @meysam81 |
| edges.append((i, node1, node2, cost)) | ||
|
|
||
| edges = sorted(edges, key=lambda edge: edge[3]) | ||
| def run_algorithm(num_nodes, num_edges, edges): |
There was a problem hiding this comment.
Please add Python type hints on function parameters and the return type.
Does num_edges always equal len(edges)? If so, let’s not force the caller to provide us num_edges.
There was a problem hiding this comment.
Adding type hints was done in #3101 which you merged a couple of hours ago.
We can remove num_edges if you say so.
There was a problem hiding this comment.
These comments were on my second computer and I never hit Send... Thanks for doing this.
…TheAlgorithms#2443) * test/graphs/kruskal: adding a test case to verify the correctness of the algorithm Fixes TheAlgorithms#2128 * grahps/kruskal: running psf/black * graphs/kruskal: read edges in a friendlier fashion Co-authored-by: Christian Clauss <cclauss@me.com> * Update minimum_spanning_tree_kruskal.py * fixup! Format Python code with psf/black push * Update test_min_spanning_tree_kruskal.py * updating DIRECTORY.md Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: John Law <johnlaw.po@gmail.com> Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* graphs/kruskal: add doctest & type hints this is a child of a previous PR TheAlgorithms#2443 its ancestor is TheAlgorithms#2128 * updating DIRECTORY.md * graphs/kruskal: fix max-line-length violation * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
…TheAlgorithms#2443) * test/graphs/kruskal: adding a test case to verify the correctness of the algorithm Fixes TheAlgorithms#2128 * grahps/kruskal: running psf/black * graphs/kruskal: read edges in a friendlier fashion Co-authored-by: Christian Clauss <cclauss@me.com> * Update minimum_spanning_tree_kruskal.py * fixup! Format Python code with psf/black push * Update test_min_spanning_tree_kruskal.py * updating DIRECTORY.md Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: John Law <johnlaw.po@gmail.com> Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* graphs/kruskal: add doctest & type hints this is a child of a previous PR TheAlgorithms#2443 its ancestor is TheAlgorithms#2128 * updating DIRECTORY.md * graphs/kruskal: fix max-line-length violation * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
And also to increase the coverage as stated in #2128
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}.