83
83
# Method for Dinic's algorithm
84
84
85
85
@traitfn function maximum_flow (
86
- flow_graph: :: :lg . IsDirected, # the input graph
87
- source:: Integer , # the source vertex
88
- target:: Integer , # the target vertex
89
- capacity_matrix:: AbstractMatrix , # edge flow capacities
90
- algorithm :: DinicAlgorithm # keyword argument for algorithm
86
+ flow_graph: :: :lg . IsDirected, # the input graph
87
+ source:: Integer , # the source vertex
88
+ target:: Integer , # the target vertex
89
+ capacity_matrix:: AbstractMatrix , # edge flow capacities
90
+ algorithm :: DinicAlgorithm # keyword argument for algorithm
91
91
)
92
92
residual_graph = residual (flow_graph)
93
93
return dinic_impl (residual_graph, source, target, capacity_matrix)
@@ -109,11 +109,11 @@ end
109
109
# Method for Push-relabel algorithm
110
110
111
111
@traitfn function maximum_flow (
112
- flow_graph: :: :lg . IsDirected, # the input graph
113
- source:: Integer , # the source vertex
114
- target:: Integer , # the target vertex
115
- capacity_matrix:: AbstractMatrix , # edge flow capacities
116
- algorithm:: PushRelabelAlgorithm # keyword argument for algorithm
112
+ flow_graph: :: :lg . IsDirected, # the input graph
113
+ source:: Integer , # the source vertex
114
+ target:: Integer , # the target vertex
115
+ capacity_matrix:: AbstractMatrix , # edge flow capacities
116
+ algorithm:: PushRelabelAlgorithm # keyword argument for algorithm
117
117
)
118
118
residual_graph = residual (flow_graph)
119
119
return push_relabel (residual_graph, source, target, capacity_matrix)
@@ -164,14 +164,14 @@ julia> f, F, labels = maximum_flow(flow_graph, 1, 8, capacity_matrix, algorithm=
164
164
```
165
165
"""
166
166
function maximum_flow (
167
- flow_graph:: lg.AbstractGraph , # the input graph
168
- source:: Integer , # the source vertex
169
- target:: Integer , # the target vertex
170
- capacity_matrix:: AbstractMatrix = # edge flow capacities
171
- DefaultCapacity (flow_graph);
172
- algorithm:: AbstractFlowAlgorithm = # keyword argument for algorithm
173
- PushRelabelAlgorithm (),
174
- restriction:: Real = 0 # keyword argument for restriction max-flow
167
+ flow_graph:: lg.AbstractGraph , # the input graph
168
+ source:: Integer , # the source vertex
169
+ target:: Integer , # the target vertex
170
+ capacity_matrix:: AbstractMatrix = # edge flow capacities
171
+ DefaultCapacity (flow_graph);
172
+ algorithm:: AbstractFlowAlgorithm = # keyword argument for algorithm
173
+ PushRelabelAlgorithm (),
174
+ restriction:: Real = 0 # keyword argument for restriction max-flow
175
175
)
176
176
if restriction > 0
177
177
return maximum_flow (flow_graph, source, target, min .(restriction, capacity_matrix), algorithm)
0 commit comments