as3: count iterations
This commit is contained in:
@@ -115,15 +115,29 @@ push_relabel :: proc(graph: [$n][n]int) -> (flow: [n][n]int) {
|
||||
}
|
||||
heights[u] = 1 + m
|
||||
}
|
||||
iterations += 1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
iterations := 0
|
||||
n :: 3
|
||||
m :: 3
|
||||
k :: 3
|
||||
c :: 3
|
||||
|
||||
main :: proc() {
|
||||
graph := create_graph(3, 3, 3, 3)
|
||||
graph := create_graph(n, m, k, c)
|
||||
print_graph(graph, elem_sep = " ")
|
||||
fmt.println()
|
||||
print_graph(push_relabel(graph), elem_sep = " ")
|
||||
fmt.printfln(
|
||||
"push-relabel(n=%d, m=%d, k=%d, C=%d) took %d iterations.",
|
||||
n,
|
||||
m,
|
||||
k,
|
||||
c,
|
||||
iterations,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user