Mark all edges emerging out of this vertex visited
for k in range ( 1 , V + 1 ) : NEW_LINE INDENT if ( gr [ v ] [ k ] and not vis [ v ] [ k ] ) : NEW_LINE INDENT vis [ v ] [ k ] = 1 NEW_LINE vis [ k ] [ v ] = 1 NEW_LINE cnt += 1 NEW_LINE DEDENT DEDENT j = j << 1 NEW_LINE v += 1 NEW_LINE