박권수

feature1.0.1 : just touch - no big change

...@@ -6,7 +6,7 @@ rank = dict() ...@@ -6,7 +6,7 @@ rank = dict()
6 6
7 def make_singleton_set(v) : 7 def make_singleton_set(v) :
8 parent[v] = v 8 parent[v] = v
9 - rank[v] = 1 9 + rank[v] = 0
10 10
11 def find(v) : 11 def find(v) :
12 if(parent[v] != v) : 12 if(parent[v] != v) :
...@@ -17,11 +17,10 @@ def union(r1, r2) : ...@@ -17,11 +17,10 @@ def union(r1, r2) :
17 if(r1 != r2) : 17 if(r1 != r2) :
18 if(rank[r1] > rank[r2]) : 18 if(rank[r1] > rank[r2]) :
19 parent[r2] = r1 19 parent[r2] = r1
20 - rank[r1] += rank[r2]
21 else : 20 else :
22 parent[r1] = r2 21 parent[r1] = r2
23 if(rank[r1] == rank[r2]) : 22 if(rank[r1] == rank[r2]) :
24 - rank[r2] += rank[r1] 23 + rank[r2] += 1
25 24
26 def Kruskal(graph) : 25 def Kruskal(graph) :
27 #n = 정점의 수 / m = 엣지의 수 26 #n = 정점의 수 / m = 엣지의 수
...@@ -39,7 +38,7 @@ def Kruskal(graph) : ...@@ -39,7 +38,7 @@ def Kruskal(graph) :
39 F = set() 38 F = set()
40 39
41 index = 0 40 index = 0
42 - while len(F) < n - 1 : 41 + while len(F) <= n - 1 :
43 e = edge_list[index] 42 e = edge_list[index]
44 43
45 p = find(e[1]) 44 p = find(e[1])
......