Algorithm: for G = (V,E), how to determine if the set of edges(e belong to E) is a valid cut set of a graph

后端 未结 2 1020
执笔经年
执笔经年 2021-01-07 11:04

Given a subset of edges of a graph G = (V,E), how can we check whether it is a valid cut-set of the graph or not? Note: A cut is a partition of the vertices of a graph into

2条回答
  •  迷失自我
    2021-01-07 11:37

    A simple algorithm would be to remove the suspected cut-edges from the graph, and see if you can still get from a node of a removed edge to its counterpart. If you still can, it was not a full cut. So if you remove E2 which had nodes A and D, you can use breadth first search from A and see if you ever get to D. It should be linear in space requirements and complexity since we store all the nodes we've visited so we don't backtrack and visit any node twice. This wiki page has some nice pictures that might help: http://en.wikipedia.org/wiki/Cut_%28graph_theory%29

提交回复
热议问题