as3: count iterations

This commit is contained in:
2026-03-26 15:00:46 +01:00
parent ac3254e60f
commit 7a95c66096

View File

@@ -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,
)
}