简体   繁体   English

使用Bellman-Ford或Network Flow查找最大数量的不同路径?

[英]Bellman-Ford or Network Flow for findin maximum number of distinct path?

We have a directed Graph (without weights), G(V, E), with two vertex s and t such that in-degree of s and out-degree of t are equals to 0 . 我们有一个有向图(无权重)G(V,E),具有两个顶点st ,使得s入度和t出度等于0 we want to find maximum number of distinct-edges paths from s to t . 我们想要找到从st最大边缘路径数量。 by using which algorithm we can do this. 通过使用哪种算法,我们可以做到这一点。 Bellman-Ford, Dijkestra, Huffman and Network Flow. Bellman-Ford,Dijkestra,Huffman和Network Flow。 I think Huffman so irrelevant, but how about others? 我认为霍夫曼是如此无关紧要,但是其他人呢? I think Network Flow is the answer, but I have no idea why? 我认为Network Flow是答案,但我不知道为什么? stackeeeers, please help me! 堆货人,请帮助我!

You can do it with Network Flow. 您可以使用网络流来做到这一点。 It even tells you how on wikipedia : 它甚至告诉您如何在Wikipedia上

Maximum edge-disjoint path 最大边缘不相交路径

Given a directed graph G = (V, E) and two vertices s and t, we are to find the maximum number of edge-disjoint paths from s to t. 给定一个有向图G =(V,E)并有两个顶点s和t,我们将找到从s到t的边不相交路径的最大数量。 This problem can be transformed to a maximum flow problem by constructing a network N = (V, E) from G with s and t being the source and the sink of N respectively and assign each edge with unit capacity. 通过从G构造网络N =(V,E),其中s和t分别是N的源和汇,并为每个边分配单位容量,可以将此问题转化为最大流量问题。

The intuition behind this is that the maximum flow algorithms basically solve your problem while finding the augmenting paths. 这背后的直觉是,最大流量算法基本上可以在找到扩展路径时解决您的问题。 What an augmenting path is is best explained in this SO question I think, by Ivaylo Strandjev : 我认为Ivaylo Strandjev这个SO问题中最好地解释了一条增加路径的方法:

An augmenting path is a simple path - a path that does not contain cycles - through the graph using only edges with positive capacity from the source to the sink. 扩充路径是一条简单的路径-不包含循环的路径-仅使用从源到接收器具有正容量的边通过图形。 So the statement above is somehow obvious - if you can not find a path from the source to the sink that only uses positive capacity edges, then the flow can not be increased(by the way the proof of that statement is not that easy). 因此,上面的语句很明显-如果找不到从源到汇的仅使用正容量边的路径,则流量无法增加(通过该语句的证明并不那么容易)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM