信息学竞赛的算法理论分析是个深海,趁着没掉进去,写个总结,而后赶忙去刷题...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 ![]() |
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)来的可是,实际上不管是网络流仍是费用流,咱们目前均不须要复杂度如此低的算法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中没什么用....