8000 Made small optimization of Prim's algorithm. · pythonpeixun/practice-python@5d049a2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5d049a2

Browse files
committed
Made small optimization of Prim's algorithm.
1 parent 45a39f6 commit 5d049a2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

graphs/undirected_graph_weighted.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ def prim(self):
8181
for i in self.get_vertex():
8282
weight = start_weight
8383
if i == 0:
84-
weight = 0
85-
q.put(([weight, i]))
84+
q.put(([0, i]))
8685
weights[i] = weight
8786
parents[i] = None
8887

0 commit comments

Comments
 (0)
0