def _is_separating_set(G, cut):
 if (len(cut) == (len(G) - 1)):
  return True
 H = G.copy(with_data=False)
 H.remove_nodes_from(cut)
 if nx.is_connected(H):
  return False
 return True

def _is_separating_set ( G , cut ) : if ( len ( cut ) == ( len ( G ) - 1 ) ) : return True H = G . copy ( with_data = False ) H . remove_nodes_from ( cut ) if nx . is_connected ( H ) : return False return True
assumes that the input graph is connected .