现在的位置: 首页 > 综合 > 正文

[ford-fulkerson] 利用残量图求解最大流

2013年08月20日 ⁄ 综合 ⁄ 共 1738字 ⁄ 字号 评论关闭

Wikipedia 上关于Ford-Fulkerson算法的描述如下

Algorithm
Ford-Fulkerson

Inputs
Graph /,G
with flow capacity /,c
, a source node /,s
, and a sink node /,t
Output
A flow /,f
from /,s
to /,t
which is a maximum

  1. f(u,v) /leftarrow 0
    for all edges /,(u,v)
  2. While there is a path /,p
    from /,s
    to /,t
    in /,G_f
    , such that /,c_f(u,v) > 0
    for all edges (u,v) /in p
    :

    1. Find /,c_f(p) = /min/{c_f(u,v) /;|/; (u,v) /in p/}
    2. For each edge (u,v) /in p
      1. f(u,v) /leftarrow f(u,v) + c_f(p)
        (Send flow along the path
        )
      2. f(v,u) /leftarrow f(v,u) - c_f(p)
        (The flow might be "returned" later
        )

虽然算法貌似很简单,但是算法正确性的证明过程确实比较困难,由于本人才疏学浅,所以证明过程虽然看了好多便,现在仍然不甚明了,今天太晚了,明天继续搞,先把今晚用残量图实现的Ford-Fulkerson算法贴出来,注释比较详细。

抱歉!评论已关闭.