查找图中的最小割边
给定一个随机无向图,我必须找到“瓶颈边”(编辑:最小切割边)才能从一个顶点到达另一个顶点。
我所说的“瓶颈边缘”(编辑:最小切割边缘)-- 假设我有以下无向图:
A
/ | \
B--C--D
| |
E--F--G
\ | /
H
要独立于所选路径边BE和DG从A到H,必须始终遍历BE和DG,因此形成“瓶颈”(编辑:最小切割)。
有一个多项式时间算法吗?
Given a random undirected graph, I must find 'bottleneck edges' (edit: minimum cut edges) to get from one vertex to another.
What I call 'bottleneck edges' (edit: minimum cut edges) --
suppose I have the following undirected graph:
A
/ | \
B--C--D
| |
E--F--G
\ | /
H
To get from A to H independently of the chosen path edges BE and DG must always be traversed, therefore making a 'bottleneck' (edit: minimum cut).
Is there a polynomial time algorithm for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来您需要最小切割,即删除最小的边集,这会将您的图形分成两部分。
http://en.wikipedia.org/wiki/Minimum_cut
Sounds like you need minimum cut, the minimal set of edges removing which will separate your graph into two pieces.
http://en.wikipedia.org/wiki/Minimum_cut
您正在寻找的是剪切。给定一个图,切割是一组边,它将顶点划分为两个不相交的子集。
假设您正在尝试获得尽可能小的切割,这是经典的最小切割问题。这是 Ford-fulkerson 算法的伪代码版本,针对您的情况进行了重新设计(无向、未加权图表)。我很确定它应该有效,但我不确定我是这里最高效/最惯用的。
例如,在您的情况下,BFS 将为我们提供路径 ABEH。删除这些边后,我们仍然能够找到路径 ADGH。删除这些边后,图被划分为可达顶点{A,B,C,D}和不可达顶点{E,F,G,H}。具有来自每个(BE 和 DG)集合的顶点的边是瓶颈边。
What you are looking for is a cut. Given a graph, a cut is a set of edges that partitions the vertices into two disjoint subsets.
Assuming you are trying to get the smallest cut possible, this is the classic min-cut problem. Here is a pseudo code version of the Ford-fulkerson algorithm, reworked for your case (undirected, unweighted graphs). I'm pretty sure it should work, but I am not sure I'm being the most efficient / idiomatic here.
For example, in your case BFS would give us the path A-B-E-H. After removing these edges, we would still be able to find the path A-D-G-H. After these edges are removed, the graph is partitioned into the reacheable vertices {A,B,C,D} and the unreacheable {E,F,G,H}. The edges that have a vertex from each (B-E and D-G) set are the bottleneck edges.