信息學競賽的算法理論分析是個深海,趁着沒掉進去,寫個總結,而後趕忙去刷題...html
本人不是OI選手且對理論方面的研究不多,這只是我這些天(從新)入門網絡流的一個小總結,問題是大大的有的,歡迎評論!算法
容量,流量,可行流,殘量網絡等等基礎概念不贅述了網絡
2.重標優先預流推動/Relabel-to-front Algorithm框架
創建鏈表,保存當前圖的拓撲序形式,不含源點匯點,按照拓撲序取點,跳過非儲流點,把以前被推動過的點從新放入表頭,並推動ide
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.post |
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 time. |
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 while KRT solves it in O(VE) for . |
感想....學習
但實際上目前競賽中經常使用的算法,不管是Dinic仍是ISAP或是HLPP,他們的速度都沒法與單純的最短路算法相比,就連理論上界達到$O(VE)$最高的SPFA都沒法達到優化
而目前科學界理論下界最低的,是Orlin's提出的集大成者,複雜度上界達到$O(VE)$,可是目前尚未進入算法競賽中來,目前所有的網絡流題目複雜度都是按照 O(V2E)來的可是,實際上不管是網絡流仍是費用流,咱們目前均不須要複雜度如此低的算法ui
絕大多數模型都不會須要創建一個極端的稠密圖/鍊形圖,點數和邊數常常是處於一個數量級的,對於$O(EV^2)$的算法足夠用了this
研究大量複雜度相近而實現方式不一樣的算法,在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中沒什麼用....