Skip to content

Commit

Permalink
network flow sight fix
Browse files Browse the repository at this point in the history
  • Loading branch information
CaveNightingale committed May 7, 2024
1 parent 9f6aa0d commit 74c9fdf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/routes/note/network-flow/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,9 @@ Dinic's Algorithm can terminate in $O(\sqrt{|V|}|E|)$ time for bipartite matchin

Since $c$ is constant $1$ for all edges, a visit to an edge either clear the capacity or find it has capacity $0$. Therefore, in a DFS between two BFS operations, the number of edges visited is at most $|E|$. Therefore, the time complexity for each DFS is $O(|E|)$.

Meanwhile, the flow in arbitrary iteration is integer-valued, it gives that the flow can be divide into several vertices-disjoint paths except the source $s$ and sink $t$ because if two paths share a vertex, there every vertices either only an in-degree (from the source $s$) or only an out-degree (to the sink $t$) with capacity $1$ and two paths violate the capacity constraint.
Meanwhile, the flow in arbitrary iteration is integer-valued, it gives that the flow can be divide into several vertices-disjoint paths except the source $s$ and sink $t$ because if two paths share a vertex, there every vertices either only an in-degree (from the source $s$) or only an out-degree (to the sink $t$) with capacity $1$ and two paths violate the capacity constraint. Notice that this holds during the whole process, because when a flow pass through a vertex, it does not change the in or out degree of the vertex. And no matter how the flow is argumented, the number of argumenting paths (even not vertices-disjoint) is same because the capacity of the edge is $1$. That mean we can calculate the number of vertices-disjoint paths other than counting the number of argumenting paths Dinic's Algorithm found.

Consider we have relabeled the vertices $\sqrt{|V|}$ times, the number of vertices-disjoint paths is at least $\sqrt{|V|}$. According to the strictly increasing level of the sink $t$, the length of newly-found path is at least $\sqrt{|V|}$. Therefore, there are no more than $|V| / \sqrt{|V|} = \sqrt{|V|}$ extra vertices-disjoint paths to be found. Since number of iteration is no more than this, the total number of iteration is the $\sqrt{|V|}$ done iteration plus the $\sqrt{|V|}$ extra iteration, which is $O(\sqrt{|V|})$.
Consider we have relabeled the vertices $\sqrt{|V|}$ times, the number of vertices-disjoint paths is at least $\sqrt{|V|}$. According to the strictly increasing level of the sink $t$, the length of newly-found path is at least $\sqrt{|V|}$. Therefore, there are no more than $|V| / \sqrt{|V|} = \sqrt{|V|}$ extra vertices-disjoint paths to be found in current residual network $G_f$, or in another word, no more than $\sqrt{|V|}$ argumenting paths on current $G_f$. Since number of iteration is no more than this, the total number of iteration is the $\sqrt{|V|}$ done iteration plus the $\sqrt{|V|}$ extra iteration, which is $O(\sqrt{|V|})$.

Therefore, the total time complexity is $O(\sqrt{|V|}|E|)$.

Expand Down

0 comments on commit 74c9fdf

Please sign in to comment.