Does Sage have a function to determine vertex cuts?
I know about is_cut_vertex(G, u)
for checking if a vertex is a cut-vertex. But is there a function in Sage to determine if a subset of vertices is a vertex cut? Although it's not too difficult to write, as shown below:
def is_vertex_cut(graph, subset):
subgraph = graph.copy()
subgraph.delete_vertices(subset)
return not subgraph.is_connected()
For each
graph
, do you want to use your function for a singlesubset
or many? I ask because it might not be the most efficient for what you aim to do. For example, to compute the list of cut vertices there is aO(m)
algorithm but running.is_cut_vertex(v)
for each vertexv
of the graph would beO(m^2)
.Thank you. I am not testing whether a set of vertices are cut vertices individually, but rather whether a subset of vertices forms a vertex cut set. Indeed, my goal is to test many subsets to determine whether they are vertex cut sets.