1. 程式人生 > >網絡流(Flow Networks)

網絡流(Flow Networks)

上傳 term and 限制 包括 傳遞 forms idt 得到

一.基本術語 Basic Terminology

  A source node in a directed graph is a node with no incoming edges. 入度為0

  A sink node in a directed graph is a node with no outgoing edges. 出度為0

  A flow network is a directed graph (V,E,c,s,t) where (V,E,c) forms a weighted graph with positive edge weights, s ∈ V is a source node and t ∈ V is a sink node.

二.最大流算法的理解

  其實感覺這個跟數學建模裏面的單目標優化問題類似,就是在源點一定的情況下,盡可能多的將物品傳到終點,限制條件是每條路徑上的最大值。

下面圖是網上隨便找的。

技術分享圖片

Flow Graph:實際上運輸上傳送的值。

Residual Graph:經過變化一次次傳輸,現在還剩余的圖,即SG-FG,感覺作用就是是因為SG畫的太亂了,分一個好判斷一點。

具體的過程:

  1)在SG中找到一條S->T的路徑,找到最小的限制,即流上的最小值(bottom neck)。

  2)在RG圖中減去這次運輸的值,得到RG;在FG中加上相應的值

  3)LOOP 1)2)直到無路可走。

這樣會有錯誤,因為最大流存在先後順序?先驅順序??(待確定名稱)這樣得不到最大流。

引入返回路徑

每當我們選擇了一個運輸路徑後,都要在RG中新畫一個反向的路徑,即這條路徑傳遞了3,反向傳遞3。

為什麽這麽做的完整解釋,後補。

三.Cuts

  A cut in a graph is a set C of edges such that removing them would disconnect the graph into left(C) (nodes reachable from s) and the right part right(C) (nodes that may reach t).

  左邊的不包括右到左方向的箭頭

   The capacity of a cut C in a flow network is the sum of the capacity of edges that goes from left to right

  

  A minimal cut is a cut with minimal capacity.

網絡流(Flow Networks)