Otherwise we get an exception because itertools.combinations is asked
to find combinations with negative size.
Instead we assert the graph is connected as-is, which in this case is
the same as asserting there are no vertices.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
def verify_graph_connected_under_edge_failures(edges, vertices, edge_vertices):
"""The graph stays connected when any single edge is removed."""
+ if len(edges) == 0:
+ return verify_graph_connected(edges, vertices, edge_vertices)
+
for subset in itertools.combinations(edges, len(edges) - 1):
try:
verify_graph_connected(subset, vertices, edge_vertices)