-
-
Notifications
You must be signed in to change notification settings - Fork 46.6k
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
Reduce the complexity of graphs/minimum_spanning_tree_prims.py #7952
Conversation
visited = [0 for i in range(len(adjacency_list))] | ||
nbr_tv = [ | ||
-1 for i in range(len(adjacency_list)) | ||
] # Neighboring Tree Vertex of selected 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.
visited = [0 for i in range(len(adjacency_list))] | |
nbr_tv = [ | |
-1 for i in range(len(adjacency_list)) | |
] # Neighboring Tree Vertex of selected vertex | |
visited = [0] * len(adjacency_list) | |
nbr_tv = [-1] * len(adjacency_list) # Neighboring Tree Vertex of selected vertex |
n = int(input("Enter number of vertices: ").strip()) | ||
e = int(input("Enter number of edges: ").strip()) |
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.
Do we gather this data and then not use it?
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.
Yes, n
wasn't used, but e
is used
n = int(input("Enter number of vertices: ").strip()) | ||
e = int(input("Enter number of edges: ").strip()) |
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.
n = int(input("Enter number of vertices: ").strip()) | |
e = int(input("Enter number of edges: ").strip()) | |
n = int(input("Enter number of vertices: ").strip()) | |
number_of_edges = int(input("Enter number of edges: ").strip()) |
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.
MUCH more readable! Thanks for doing this.
Are you ready to merge this?
Yes |
Describe your change:
Reduce the complexity of graphs/minimum_spanning_tree_prims.py from 21 to 7
Checklist:
Fixes: #{$ISSUE_NO}
.