信息學競賽的算法理論分析是個深海,趁着沒掉進去,寫個總結,然后趕緊去刷題...
本人不是OI選手且對理論方面的研究很少,這只是我這些天(重新)入門網絡流的一個小總結,問題是大大的有的,歡迎評論!
容量,流量,可行流,殘量網絡等等基礎概念不贅述了
2.重標優先預流推進/Relabel-to-front Algorithm
建立鏈表,保存當前圖的拓撲序形式,不含源點匯點,按照拓撲序取點,跳過非儲流點,把之前被推進過的點重新放入表頭,並推進
Method | Complexity | Description |
---|---|---|
Linear programming | Constraints given by the definition of a legal flow. See the linear program here. | |
Ford–Fulkerson algorithm | $O(Emax|f|)$ | As long as there is an open path through the residual graph, send the minimum of the residual capacities on the path. The algorithm is only guaranteed to terminate if all weights are rational. Otherwise it is possible that the algorithm will not converge to the maximum value. However, if the algorithm terminates, it is guaranteed to find the maximum value. |
Edmonds–Karp algorithm | $O(VE^2)$ | A specialization of Ford–Fulkerson, finding augmenting paths with breadth-first search. |
Dinic's blocking flow algorithm | $O(V^2E)$ | In each phase the algorithms builds a layered graph with breadth-first search on the residual graph. The maximum flow in a layered graph can be calculated in O(VE) time, and the maximum number of the phases is n-1. In networks with unit capacities, Dinic's algorithm terminates in ![]() |
MPM (Malhotra, Pramodh-Kumar and Maheshwari) algorithm |
$O(V^3)$ | Only works on acyclic networks. Refer to the Original Paper. |
Dinic's algorithm | $O(VE log(V))$ | The dynamic trees data structure speeds up the maximum flow computation in the layered graph to O(V E log(V)). |
General push-relabel maximum flow algorithm | $O(V^2E)$ | The push relabel algorithm maintains a preflow, i.e. a flow function with the possibility of excess in the vertices. The algorithm runs while there is a vertex with positive excess, i.e. an active vertex in the graph. The push operation increases the flow on a residual edge, and a height function on the vertices controls which residual edges can be pushed. The height function is changed with a relabel operation. The proper definitions of these operations guarantee that the resulting flow function is a maximum flow. |
Push-relabel algorithm with FIFO vertex selection rule | $O(V^3)$ | Push-relabel algorithm variant which always selects the most recently active vertex, and performs push operations until the excess is positive or there are admissible residual edges from this vertex. |
Push-relabel algorithm with dynamic trees | ![]() |
The algorithm builds limited size trees on the residual graph regarding to height function. These trees provide multilevel push operations. |
KRT (King, Rao, Tarjan)'s algorithm |
![]() |
|
Binary blocking flow algorithm |
![]() |
The value U corresponds to the maximum capacity of the network. |
James B Orlin's + KRT (King, Rao, Tarjan)'s algorithm |
![]() |
Orlin's algorithm solves max-flow in O(VE) time for ![]() ![]() |
感想....
但實際上目前競賽中常用的算法,無論是Dinic還是ISAP或是HLPP,他們的速度都無法與單純的最短路算法相比,就連理論上界達到$O(VE)$最高的SPFA都無法達到
而目前科學界理論下界最低的,是Orlin's提出的集大成者,復雜度上界達到$O(VE)$,但是目前還沒有進入算法競賽中來,目前所有的網絡流題目復雜度都是按照 O(V2E)來的但是,實際上無論是網絡流還是費用流,我們目前均不需要復雜度如此低的算法
絕大多數模型都不會需要建立一個極端的稠密圖/鏈形圖,點數和邊數經常是處於一個數量級的,對於$O(EV^2)$的算法足夠用了
研究大量復雜度相近而實現方式不同的算法,在OI中是有意義的,
OI賽制中需要大量的不同數據來區分不同的人實力,達到區分度,這也是OI選手對於復雜度,讀入輸出,花式優化的精益求精的原因,
以Bellmon-Ford最短路為例,的復雜度達到了$O(VE)$
但是實際上有隊列優化,不重復入隊/重復入隊,SLF,均值,轉DFS,鄰接表指針化等等不同的優化/實現方式
在不同的圖中都有不同的效果,即使其理論復雜度依然是$O(VE)$,但只要選手根據不同的圖去選擇優化方式,就幾乎無法被卡了
而且對於一個題,即使你的復雜度無法滿足數據量,你依然可以通過其中很多的數據組,得到很多分,此時,一個優化到極致的算法就很重要了...
而在ICPC賽制中,區分度更多的在題目本身的思維,程序准確性,與復雜度上界,因為所有算法都通過所有的樣例,也就是說必須用正確的復雜度通過,
在這種情況下,錯誤的復雜度毫無意義,必須選擇一個復雜度穩定,編碼容易,靈活的穩定算法,且從下手的一開始,就必須嘗試去滿足所有的極限數據和情形
OI的90分可以接受,而ICPC90分就是0分,且0ms的AC和10000ms的AC都同樣正確,尤其對於網絡流,建一個正確合適網絡圖,比花式優化的效果更大,尤其是減少多余邊

甚至超過了在VJ的leaderboard中,所有公開代碼里最快的dijkstra(Rank5),和第一名相當,但在ICPC中沒什么用....