Loop through all the values of the nodes which are not yet included in MST and find the minimum valued one .
for i in range ( n ) : NEW_LINE INDENT if ( mstset [ i ] == False and keyval [ i ] < mini ) : NEW_LINE INDENT mini = keyval [ i ] NEW_LINE mini_index = i NEW_LINE DEDENT DEDENT return mini_index NEW_LINE