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

廉价感情. 提交于 2019-12-09 01:44:08

问题


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 two disjoint subsets. So, cut-set of the cut is the set of edges whose end points are in different subsets of the partition. I am interested to find an algorithm for this problem


回答1:


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




回答2:


It's a valid cut set if, with that edge subset removed, it's no longer a connected graph.

If you're asking for algorithms, you should be able to start at any node and see if you can reach all other nodes via depth first search. If so, it's not a valid cut set, if it can't, it's a valid cut set.



来源:https://stackoverflow.com/questions/5768329/algorithm-for-g-v-e-how-to-determine-if-the-set-of-edgese-belong-to-e-is

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!