@@ -9,10 +9,10 @@ Takes approximately ``\\mathcal{O}(|V|^{3})`` time.
99"""
1010function push_relabel end
1111@traitfn function push_relabel {T} (
12- residual_graph: :: :lg . IsDirected, # the input graph
13- source:: Integer , # the source vertex
14- target:: Integer , # the target vertex
15- capacity_matrix:: AbstractMatrix{T} # edge flow capacities
12+ residual_graph: :: :lg . IsDirected, # the input graph
13+ source:: Integer , # the source vertex
14+ target:: Integer , # the target vertex
15+ capacity_matrix:: AbstractMatrix{T} # edge flow capacities
1616 )
1717
1818 n = lg. nv (residual_graph)
@@ -57,10 +57,10 @@ Push inactive node `v` into queue `Q` and activates it. Requires preallocated
5757"""
5858
5959function enqueue_vertex! (
60- Q:: AbstractVector ,
61- v:: Integer , # input vertex
62- active:: AbstractVector{Bool} ,
63- excess:: AbstractVector
60+ Q:: AbstractVector ,
61+ v:: Integer , # input vertex
62+ active:: AbstractVector{Bool} ,
63+ excess:: AbstractVector
6464 )
6565 if ! active[v] && excess[v] > 0
6666 active[v] = true
@@ -78,15 +78,15 @@ matrix, and `excess`, `height, `active`, and `Q` vectors.
7878"""
7979function push_flow! end
8080@traitfn function push_flow! (
81- residual_graph: :: :lg . IsDirected, # the input graph
82- u:: Integer , # input from-vertex
83- v:: Integer , # input to-vetex
84- capacity_matrix:: AbstractMatrix ,
85- flow_matrix:: AbstractMatrix ,
86- excess:: AbstractVector ,
87- height:: AbstractVector{Int} ,
88- active:: AbstractVector{Bool} ,
89- Q:: AbstractVector
81+ residual_graph: :: :lg . IsDirected, # the input graph
82+ u:: Integer , # input from-vertex
83+ v:: Integer , # input to-vetex
84+ capacity_matrix:: AbstractMatrix ,
85+ flow_matrix:: AbstractMatrix ,
86+ excess:: AbstractVector ,
87+ height:: AbstractVector{Int} ,
88+ active:: AbstractVector{Bool} ,
89+ Q:: AbstractVector
9090 )
9191 flow = min (excess[u], capacity_matrix[u, v] - flow_matrix[u, v])
9292
@@ -121,13 +121,13 @@ Requires arguments:
121121"""
122122function gap! end
123123@traitfn function gap! (
124- residual_graph: :: :lg . IsDirected, # the input graph
125- h:: Int , # cutoff height
126- excess:: AbstractVector ,
127- height:: AbstractVector{Int} ,
128- active:: AbstractVector{Bool} ,
129- count:: AbstractVector{Int} ,
130- Q:: AbstractVector # FIFO queue
124+ residual_graph: :: :lg . IsDirected, # the input graph
125+ h:: Int , # cutoff height
126+ excess:: AbstractVector ,
127+ height:: AbstractVector{Int} ,
128+ active:: AbstractVector{Bool} ,
129+ count:: AbstractVector{Int} ,
130+ Q:: AbstractVector # FIFO queue
131131 )
132132 n = lg. nv (residual_graph)
133133 for v in lg. vertices (residual_graph)
@@ -147,15 +147,15 @@ Relabel a node `v` with respect to its neighbors to produce an admissable edge.
147147"""
148148function relabel! end
149149@traitfn function relabel! (
150- residual_graph: :: :lg . IsDirected, # the input graph
151- v:: Integer , # input vertex to be relabeled
152- capacity_matrix:: AbstractMatrix ,
153- flow_matrix:: AbstractMatrix ,
154- excess:: AbstractVector ,
155- height:: AbstractVector{Int} ,
156- active:: AbstractVector{Bool} ,
157- count:: AbstractVector{Int} ,
158- Q:: AbstractVector
150+ residual_graph: :: :lg . IsDirected, # the input graph
151+ v:: Integer , # input vertex to be relabeled
152+ capacity_matrix:: AbstractMatrix ,
153+ flow_matrix:: AbstractMatrix ,
154+ excess:: AbstractVector ,
155+ height:: AbstractVector{Int} ,
156+ active:: AbstractVector{Bool} ,
157+ count:: AbstractVector{Int} ,
158+ Q:: AbstractVector
159159 )
160160 n = lg. nv (residual_graph)
161161 count[height[v] + 1 ] -= 1
@@ -179,15 +179,15 @@ vertex if the excess remains non-zero.
179179"""
180180function discharge! end
181181@traitfn function discharge! (
182- residual_graph: :: :lg . IsDirected, # the input graph
183- v:: Integer , # vertex to be discharged
184- capacity_matrix:: AbstractMatrix ,
185- flow_matrix:: AbstractMatrix ,
186- excess:: AbstractVector ,
187- height:: AbstractVector{Int} ,
188- active:: AbstractVector{Bool} ,
189- count:: AbstractVector{Int} ,
190- Q:: AbstractVector # FIFO queue
182+ residual_graph: :: :lg . IsDirected, # the input graph
183+ v:: Integer , # vertex to be discharged
184+ capacity_matrix:: AbstractMatrix ,
185+ flow_matrix:: AbstractMatrix ,
186+ excess:: AbstractVector ,
187+ height:: AbstractVector{Int} ,
188+ active:: AbstractVector{Bool} ,
189+ count:: AbstractVector{Int} ,
190+ Q:: AbstractVector # FIFO queue
191191 )
192192 for to in lg. out_neighbors (residual_graph, v)
193193 excess[v] == 0 && break
0 commit comments