Skip to content

Reduce the complexity of graphs/minimum_spanning_tree_prims.py #7952

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

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[flake8]
max-line-length = 88
# max-complexity should be 10
max-complexity = 21
max-complexity = 20
extend-ignore =
# Formatting style for `black`
E203 # Whitespace before ':'
Expand Down
10 changes: 10 additions & 0 deletions graphs/minimum_spanning_tree_prims.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@


def prisms_algorithm(l): # noqa: E741
"""
>>> l = {0: [[1, 1], [3, 3]], \
1: [[0, 1], [2, 6], [3, 5], [4, 1]], \
2: [[1, 6], [4, 5], [5, 2]], \
3: [[0, 3], [1, 5], [4, 1]], \
4: [[1, 1], [2, 5], [3, 1], [5, 4]], \
5: [[2, 2], [4, 4]]}
>>> prisms_algorithm(l)
[(0, 1), (1, 4), (4, 3), (4, 5), (5, 2)]
"""

node_position = []

Expand Down