1 最大流问题

1.1 记号简记

无向图

图论 - 图1#card=math&code=G%3D%28V%2CE%29&height=16&width=65),顶点集合 图论 - 图2,边集合 图论 - 图3,边 图论 - 图4

有向图

图论 - 图5#card=math&code=D%3D%28V%2CA%29&height=16&width=66),顶点集合 图论 - 图6,弧集合 图论 - 图7,弧 图论 - 图8#card=math&code=%28v_i%2Cv_j%29&height=17&width=39)。

图的支撑树

由图的 图论 - 图9 个节点与 图论 - 图10 条边组成的树为图的支撑树。

下例介绍求最小支撑树的两种方法:

图论 - 图11

1.2 避圈法

图论 - 图12,令 图论 - 图13,从 图论 - 图14 中选最小权边 图论 - 图15

图论 - 图16,从 图论 - 图17 中选最小权边 图论 - 图18, 且 图论 - 图19#card=math&code=%28v%2CE_1%5Ccup%5C%7B%5Bv_2%2Cv_4%5D%5C%7D%29&height=16&width=107) 不含圈,令 图论 - 图20

图论 - 图21,从 图论 - 图22 中选最小权边 图论 - 图23, 且 图论 - 图24#card=math&code=%28v%2CE_2%5Ccup%5C%7B%5Bv_4%2Cv_5%5D%5C%7D%29&height=16&width=107) 不含圈,令 图论 - 图25

图论 - 图26,从 图论 - 图27 中选最小权边 图论 - 图28, 且 图论 - 图29#card=math&code=%28v%2CE_3%5Ccup%5C%7B%5Bv_5%2Cv_6%5D%5C%7D%29&height=16&width=107) 不含圈,令 图论 - 图30

图论 - 图31,从 图论 - 图32 中选最小权边 图论 - 图33, 且 图论 - 图34#card=math&code=%28v%2CE_4%5Ccup%5C%7B%5Bv_1%2Cv_2%5D%5C%7D%29&height=16&width=107) 不含圈,令 图论 - 图35

图论 - 图36,任一条未选边都与已选边构成圈,接待终止,图论 - 图37

图论 - 图38#card=math&code=%28v%2CE_5%29&height=16&width=39) 就是最小支撑树

1.3 破圈法

取圈 图论 - 图39#card=math&code=%28v_1%2Cv_2%2Cv_3%2Cv_1%29&height=16&width=79),边 图论 - 图40 的权最大,去掉 图论 - 图41

取圈 图论 - 图42#card=math&code=%28v_3%2Cv_5%2Cv_2%2Cv_3%29&height=16&width=79),边 图论 - 图43 的权最大,去掉 图论 - 图44

取圈 图论 - 图45#card=math&code=%28v_3%2Cv_5%2Cv_4%2Cv_2%2Cv_3%29&height=16&width=98),边 图论 - 图46 的权最大,去掉 图论 - 图47

取圈 图论 - 图48#card=math&code=%28v_5%2Cv_6%2Cv_4%2Cv_5%29&height=16&width=79),边 图论 - 图49 的权最大,去掉 图论 - 图50,得到不含圈的图,即为最小支撑树。

2 最短路

2.1 Dijkstra 标号法

图论 - 图51

  • 适用于求 图论 - 图52 的最短路,权非负。
  • 步骤:
  1. 图论 - 图53,令 图论 - 图54
  2. 图论 - 图55,令 图论 - 图56
  3. 图论 - 图57%3Dmin%5C%7B6%2C9%5C%7D%3D6#card=math&code=T%28V_3%29%3Dmin%5C%7B6%2C9%5C%7D%3D6&height=16&width=135),令 图论 - 图58
  4. 图论 - 图59,令 图论 - 图60
  5. 图论 - 图61%3Dmin%5C%7B7%2C8%5C%7D%3D7#card=math&code=T%28V_t%29%3Dmin%5C%7B7%2C8%5C%7D%3D7&height=16&width=133),令 图论 - 图62
  6. 故最短路为:图论 - 图63#card=math&code=%28V_s%2CV_2%2CV_4%2CV_t%29&height=16&width=82)

2.2 逐次逼近法

图论 - 图64

  • 适用于求 图论 - 图65 到任意一点的最短路。
  • 权可负。

图论 - 图66%7D%20%26%20p%7Bij%7D%5E%7B(2)%7D%20%26%20p%7Bij%7D%5E%7B(3)%7D%20%26%20p%7Bij%7D%5E%7B(4)%7D%20%26%20p%7Bij%7D%5E%7B(5)%7D%5C%5C%0AVs%20%26%200%20%26%204%20%26%203%20%26%20%26%20%26%20%26%200%20%26%200%20%26%200%20%26%200%20%26%200%5C%5C%20%20%0AV_1%20%26%20%20%26%200%20%26%202%20%26%205%20%26%20%26%20%26%204%20%26%204%20%26%204%20%26%204%20%26%204%5C%5C%0AV_2%20%26%20-3%20%26%20%20%26%200%20%26%20%5Cunderline%20%7B3%7D%20%20%26%20%26%20%26%203%20%26%203%20%26%203%20%26%203%20%26%203%5C%5C%20%0AV_3%20%26%20%20%26%20%20%26%20-3%20%26%200%20%26%20%5Cunderline%20%7B2%7D%20%20%26%20%26%20%20%26%20%5Cunderline%20%7B6%7D%20%20%26%206%20%26%206%20%26%206%5C%5C%20%0AV_4%20%26%20%20%26%20%20%26%20-2%20%26%20%26%200%20%26%20%5Cunderline%20%7B2%7D%20%20%26%20%20%26%20%20%26%20%5Cunderline%20%7B8%7D%20%20%26%208%20%26%208%5C%5C%20%0AV_t%20%26%20%20%26%20%20%26%20%20%26%20-2%20%26%20-2%20%26%200%20%26%20%20%26%20%20%26%20%20%26%20%5Cunderline%20%7B10%7D%20%20%26%2010%5C%5C%20%0A%5Cend%7Bmatrix%7D%0A#card=math&code=%5Cbegin%7Bmatrix%7D%0A%20%20%26%20%20V_s%20%26%20V_1%20%26%20V_2%20%26%20V_3%20%26%20V_4%20%26%20V_t%20%26%20p%7Bij%7D%5E%7B%281%29%7D%20%26%20p%7Bij%7D%5E%7B%282%29%7D%20%26%20p%7Bij%7D%5E%7B%283%29%7D%20%26%20p%7Bij%7D%5E%7B%284%29%7D%20%26%20p%7Bij%7D%5E%7B%285%29%7D%5C%5C%0AV_s%20%26%200%20%26%204%20%26%203%20%26%20%26%20%26%20%26%200%20%26%200%20%26%200%20%26%200%20%26%200%5C%5C%20%20%0AV_1%20%26%20%20%26%200%20%26%202%20%26%205%20%26%20%26%20%26%204%20%26%204%20%26%204%20%26%204%20%26%204%5C%5C%0AV_2%20%26%20-3%20%26%20%20%26%200%20%26%20%5Cunderline%20%7B3%7D%20%20%26%20%26%20%26%203%20%26%203%20%26%203%20%26%203%20%26%203%5C%5C%20%0AV_3%20%26%20%20%26%20%20%26%20-3%20%26%200%20%26%20%5Cunderline%20%7B2%7D%20%20%26%20%26%20%20%26%20%5Cunderline%20%7B6%7D%20%20%26%206%20%26%206%20%26%206%5C%5C%20%0AV_4%20%26%20%20%26%20%20%26%20-2%20%26%20%26%200%20%26%20%5Cunderline%20%7B2%7D%20%20%26%20%20%26%20%20%26%20%5Cunderline%20%7B8%7D%20%20%26%208%20%26%208%5C%5C%20%0AV_t%20%26%20%20%26%20%20%26%20%20%26%20-2%20%26%20-2%20%26%200%20%26%20%20%26%20%20%26%20%20%26%20%5Cunderline%20%7B10%7D%20%20%26%2010%5C%5C%20%0A%5Cend%7Bmatrix%7D%0A&height=143&width=366)

图论 - 图67图论 - 图68 最短路为:图论 - 图69#card=math&code=%28V_s%2CV_2%2CV_3%2CV_4%2CV_t%29&height=16&width=102),最短路权为 10。

2.3 Floyd 法

  • 算法核心:图论 - 图70%7D%3Dmin%5C%7Bd%7Bij%7D%5E%7B(k)%7D%2Cd%7Bik%7D%5E%7B(k)%7D%2Bd%7Bkj%7D%5E%7B(k)%7D%5C%7D#card=math&code=d%7Bij%7D%5E%7B%28k%2B1%29%7D%3Dmin%5C%7Bd%7Bij%7D%5E%7B%28k%29%7D%2Cd%7Bik%7D%5E%7B%28k%29%7D%2Bd_%7Bkj%7D%5E%7B%28k%29%7D%5C%7D&height=23&width=174)
  • 适用于求图中任意两点间最短距离。
  • 建造银行、医院等问题。
  • 除下面的例子,其他应用举例请参考【P311】。

图论 - 图71

求解:

图论 - 图72

3 最大流问题

3.1 网络与流

  • 给定一个有向图 图论 - 图73#card=math&code=D%3D%28V%2CA%29&height=16&width=66),在 图论 - 图74 中指定了两个点,发点 图论 - 图75 和收点 图论 - 图76,其余的点为中间点。图论 - 图77%5Cin%20A#card=math&code=%28Vi%2CV_j%29%5Cin%20A&height=17&width=69),均对应有一个数 ![](https://g.yuque.com/gr/latex?c%7Bij%7D%5Cge%200#card=math&code=c_%7Bij%7D%5Cge%200&height=16&width=39) (容量),则称 图论 - 图78 为一个网络 图论 - 图79#card=math&code=D%3D%28V%2CA%2CC%29&height=16&width=82),图论 - 图80 为容量集合。
  • 图论 - 图81#card=math&code=f%3D%5C%7Bf%28vi%2Cv_j%5C%7D%2Cf%7Bij%7D%3Df%28v_i%2Cv_j%29&height=17&width=167) 是弧 图论 - 图82#card=math&code=%28v_i%2Cv_j%29&height=17&width=39) 上的流量。

3.2 可行流与最大流

可行流

可行流为满足以下两个条件的流 图论 - 图83

  1. 容量限制条件:对每一条弧 图论 - 图84#card=math&code=%28vi%2Cv_j%5Cin%20A%29&height=17&width=66),有 ![](https://g.yuque.com/gr/latex?0%5Cle%20f%7Bij%7D%20%5Cle%20c%7Bij%7D#card=math&code=0%5Cle%20f%7Bij%7D%20%5Cle%20c_%7Bij%7D&height=16&width=72)
  2. 平衡条件:

图论 - 图85%20%7D%7B%20f%7B%20ij%20%7D%20%7D%20-%5Csum%20%7B%20(v%7B%20j%20%7D%2Cv%7B%20i%20%7D)%20%7D%7B%20f%7B%20ji%20%7D%20%7D%20%3D0%2Ci%5Cneq%20s%2Ct%5C%5C%0A%5Csum%20%7B%20(v%7B%20s%7D%2Cv%7B%20j%20%7D)%20%7D%7B%20f%7B%20sj%20%7D%20%7D%20-%5Csum%20%7B%20(v%7B%20j%20%7D%2Cv%7B%20s%20%7D)%20%7D%7B%20f%7B%20js%20%7D%20%7D%20%3Dv(f)%2Ci%20%3Ds%5C%5C%0A%5Csum%20%7B%20(v%7B%20t%7D%2Cv%7B%20j%20%7D)%20%7D%7B%20f%7B%20tj%20%7D%20%7D%20-%5Csum%20%7B%20(v%7B%20j%20%7D%2Cv%7B%20t%20%7D)%20%7D%7B%20f%7B%20jt%20%7D%20%7D%20%3D-v(f)%2Ci%20%3Dt%0A#card=math&code=%5Csum%20%7B%20%28v%7B%20i%20%7D%2Cv%7B%20j%20%7D%29%20%7D%7B%20f%7B%20ij%20%7D%20%7D%20-%5Csum%20%7B%20%28v%7B%20j%20%7D%2Cv%7B%20i%20%7D%29%20%7D%7B%20f%7B%20ji%20%7D%20%7D%20%3D0%2Ci%5Cneq%20s%2Ct%5C%5C%0A%5Csum%20%7B%20%28v%7B%20s%7D%2Cv%7B%20j%20%7D%29%20%7D%7B%20f%7B%20sj%20%7D%20%7D%20-%5Csum%20%7B%20%28v%7B%20j%20%7D%2Cv%7B%20s%20%7D%29%20%7D%7B%20f%7B%20js%20%7D%20%7D%20%3Dv%28f%29%2Ci%20%3Ds%5C%5C%0A%5Csum%20%7B%20%28v%7B%20t%7D%2Cv%7B%20j%20%7D%29%20%7D%7B%20f%7B%20tj%20%7D%20%7D%20-%5Csum%20%7B%20%28v%7B%20j%20%7D%2Cv%7B%20t%20%7D%29%20%7D%7B%20f_%7B%20jt%20%7D%20%7D%20%3D-v%28f%29%2Ci%20%3Dt%0A&height=115&width=583)

  • 图论 - 图86#card=math&code=v%28f%29&height=16&width=24) 为可行流流量 图论 - 图87 发点净输出量或收点净输入量。
  • 可行流总存在,即零流,图论 - 图88%3D0%2Cf%7Bij%7D%3D0#card=math&code=v%28f%29%3D0%2Cf%7Bij%7D%3D0&height=17&width=95)

最大流问题——数学模型

图论 - 图89

最大流问题本质是一个特殊的线性规划的问题。

3.3 增广链