logGraph [ u ] [ v ] is non zero only for adjacent vertices of m mstSet [ v ] is false for vertices not yet included in MST . Update the key only if logGraph [ u ] [ v ] is smaller than key [ v ]
if ( logGraph [ u ] [ v ] > 0 and mstSet [ v ] == False and logGraph [ u ] [ v ] < key [ v ] ) : NEW_LINE INDENT parent [ v ] = u NEW_LINE key [ v ] = logGraph [ u ] [ v ] NEW_LINE DEDENT