Algorithm 在最大流问题中,如何找到提供最大流的所有可能路径集?

Algorithm 在最大流问题中,如何找到提供最大流的所有可能路径集?,algorithm,graph,network-flow,Algorithm,Graph,Network Flow,我知道在流量网络中,可以找到从源(s)到接收器(t)的最大流量。 但是有没有一种算法可以找到所有可能的路径集,从而得到最大流量 例如: 在下面的网络中,所有边的容量均为1。不难看出,从s到t的最大流量为3。但如何找到承载该流的路径组合呢 预期产出: 路径集1:s-0-1-t、s-2-3-t、s-5-6-t 路径集2:s-0-1-t、s-2-4-t、s-5-6-t 路径集3:s-0-3-t、s-2-4-t、s-5-6-t 路径集4:s-0-4-t、s-2-3-t、s-5-6-t 有人问了一个类似

我知道在流量网络中,可以找到从源(
s
)到接收器(
t
)的最大流量。
但是有没有一种算法可以找到所有可能的路径集,从而得到最大流量

例如:
在下面的网络中,所有边的容量均为1。不难看出,从
s
t
的最大流量为3。但如何找到承载该流的路径组合呢

预期产出:
路径集1:
s-0-1-t、s-2-3-t、s-5-6-t

路径集2:
s-0-1-t、s-2-4-t、s-5-6-t

路径集3:
s-0-3-t、s-2-4-t、s-5-6-t

路径集4:
s-0-4-t、s-2-3-t、s-5-6-t


有人问了一个类似的问题,但似乎没有得到明确的答案。

根据您的评论,我假设所有弧都是定向的,容量为1

高级伪码是

define EnumerateFlows(G, s, t):
    if G has no s-t path:
        yield []  # solution with no paths
    else:
        for P in EnumeratePaths(G, s, t):
            derive G' = G - P
            let s-u be the first arc in P
            derive G'' = G' - {arcs s-v such that v < u}  # ensure canonically ordered solutions only
            for F in EnumerateFlows(G'', s, t):
                yield [P, F...]  # solution with P followed by the elements of F
要改进
枚举流
,需要添加一个检查以确保残差图中仍然存在一个最大流


至于底层实现建议,我的建议是对
G
使用邻接列表表示,并在列表内外拼接弧。另一方面,也许你的图足够小,这无关紧要。

我们能假设所有的弧都是cap 1吗?这使问题变得容易多了。@DavidEisenstat是的,所有弧都是cap 1。
define EnumeratePaths(G, s, t):
    if s = t:
        yield [s]
    else:
        for u in {successors of s in t}:
            for P in EnumeratePaths(G - {s-u}, u, t):
                yield [s, P...]