Carrying out normal Kruskal Algorithm
for u in range ( 1 , n + 1 ) : NEW_LINE INDENT for v in g [ u ] : NEW_LINE INDENT x = find ( u ) NEW_LINE y = find ( v ) NEW_LINE if ( x == y ) : NEW_LINE INDENT continue NEW_LINE DEDENT Union ( x , y ) NEW_LINE print ( " { } ▁ { } " . format ( u , v ) ) NEW_LINE DEDENT DEDENT