Maximize count of nodes disconnected from all other nodes in a Graph | Function which returns the maximum number of isolated nodes ; Used nodes ; Remaining edges ; Count nodes used ; If given edges are non - zero ; Driver Code ; Given N and E ; Function call
def maxDisconnected ( N , E ) : NEW_LINE INDENT curr = 1 NEW_LINE rem = E NEW_LINE while ( rem > 0 ) : NEW_LINE INDENT rem = rem - min ( curr , rem ) NEW_LINE curr += 1 NEW_LINE DEDENT if ( curr > 1 ) : NEW_LINE INDENT return N - curr NEW_LINE DEDENT else : NEW_LINE INDENT return N NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N = 5 NEW_LINE E = 1 NEW_LINE print ( maxDisconnected ( N , E ) ) NEW_LINE DEDENT