网络流四种主流算法时间复杂度分析

博客权威分析了多种网络流算法的时间复杂度。FF算法用dfs实现,EK算法用bfs实现,二者时间复杂度均为O(V*E^2);Dinic算法递归实现,时间复杂度O(V^2*E);SAP算法时间复杂度也是O(V^2*E),优化后更优。一般大数据用SAP,小数据用Dinic。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

权威分析各种实现网络流算法的时间复杂度

简单总结 

FF算法: 利用dfs实现,时间复杂度O(V*E^2)

EK算法:利用bfs实现,时间复杂度O(V*E^2)

Dinic算法:递归实现,时间复杂度O(V^2*E)

SAP算法:时间复杂度O(V^2*E)但是加上弧优化和间隙优化之后时间复杂度非常可观

由于一般边数>>顶点数,所以后面两个算法时间复杂度优势很大

而由于递归,时间复杂度上SAP优于Dinic

因此小数据(水)的时候使用Dinic,大数据的时候还是用SAP

排名SAP > Dinic > EK ≈ FF,所以学了EK就不学FF了,但是SAP和Dinic都要学!

MethodComplexityDescription
Linear programming Constraints given by the definition of a legal flow. See the linear program here.
Ford–Fulkerson algorithmO(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 algorithmO(VE2)A specialization of Ford–Fulkerson, finding augmenting paths with breadth-first search.
Dinic's blocking flow algorithmO(V2E)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 O(\min\{V^{2/3}, E^{1/2}\}E) time.
MPM (Malhotra, Pramodh-Kumar and Maheshwari) algorithmO(V3)Only works on acyclic networks. Refer to the Original Paper.
Dinic's algorithmO(VElog(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 algorithmO(V2E)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 ruleO(V3))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 treesO\left(VE\log {\frac {V^{2}}{E}}\right)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 algorithmO(EV\log _{\frac {E}{V\log V}}V) 
Binary blocking flow algorithmO\left(E\cdot \min(V^{\frac {2}{3}},{\sqrt {E}})\cdot \log {\frac {V^{2}}{E}}\log {U}\right)The value U corresponds to the maximum capacity of the network.
James B Orlin's + KRT (King, Rao, Tarjan)'s algorithmO(VE)Orlin's algorithm solves max-flow in O(VE) time for E\leq O(V^{​{16 \over 15}-\epsilon }) while KRT solves it in O(VE) for E>V^{1+\epsilon }.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值