2020-1ํ•™๊ธฐ, ๋Œ€ํ•™์—์„œ โ€˜์•Œ๊ณ ๋ฆฌ์ฆ˜โ€™ ์ˆ˜์—…์„ ๋“ฃ๊ณ  ๊ณต๋ถ€ํ•œ ๋ฐ”๋ฅผ ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. ์ง€์ ์€ ์–ธ์ œ๋‚˜ ํ™˜์˜์ž…๋‹ˆ๋‹ค :)

19 minute read

2020-1ํ•™๊ธฐ, ๋Œ€ํ•™์—์„œ โ€˜์•Œ๊ณ ๋ฆฌ์ฆ˜โ€™ ์ˆ˜์—…์„ ๋“ฃ๊ณ  ๊ณต๋ถ€ํ•œ ๋ฐ”๋ฅผ ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. ์ง€์ ์€ ์–ธ์ œ๋‚˜ ํ™˜์˜์ž…๋‹ˆ๋‹ค :)

์ด๋ฒˆ ํฌ์ŠคํŠธ์—์„œ๋Š” Network Flow ๋ฌธ์ œ์— ๋Œ€ํ•œ ๊ฐœ์š”์™€ Network Flow ๋ฌธ์ œ์˜ ํ•ต์‹ฌ์ด ๋˜๋Š” ์ •๋ฆฌ์ธ โ€œMax-Flow Min-Cut Theoremโ€์— ๋Œ€ํ•ด ๋‹ค๋ฃน๋‹ˆ๋‹ค. ์‹ค์ œ ์˜ˆ์ œ์™€ ์ฝ”๋“œ๋Š” ์ด์–ด์ง€๋Š” ํฌ์ŠคํŠธ Ford-Fulkerson & Edmons-Karp Algorithm๋ฅผ ์ฐธ๊ณ ํ•ด์ฃผ์„ธ์š”! ๐Ÿ˜‰


Introduction to Network Flow

<Network Flow> ๋ฌธ์ œ๋Š” ์•„๋ž˜์™€ ๊ฐ™์€ Directed Graph $G$์— ๋Œ€ํ•ด source $S$์—์„œ sink $t$๋กœ ํ˜๋Ÿฌ๊ฐ€๋Š” Flow์˜ ๅˆ์„ ์ตœ๋Œ€ํ™” ํ•˜๋Š” ๋ฌธ์ œ๋‹ค.

์ข€๋” formal ํ•˜๊ฒŒ ๊ธฐ์ˆ ํ•˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

For a directed graph $G = (V, E)$, we have two special nodes source $s$ and sink $t$. And each edges has capacity $c_e > 0$, respectively.

We want to send as much flow as possible from $s$ to $t$ s.t. $0 \le f_e \le c_e$ for all $e \in E$.

But for each node $u$, the flow must be conserved with $\displaystyle\sum_{(w, u) \in E} f_{wu} = \sum_{(u, z) \in E} f_{uz}$.
// node $u$์—์„œ ๋“ค์–ด์˜ค๋Š” ์–‘๊ณผ ๋‚˜๊ฐ€๋Š” ์–‘์ด ๊ฐ™์•„์•ผ ํ•œ๋‹ค.

Also the size of flow $\text{size}(f)$ should be

\[\text{size}(f) = \sum_{(s, u) \in E} f_{su} = \sum_{(v, t) \in E} f_{vt}\]

์œ„์™€ ๊ฐ™์ด ๊ธฐ์ˆ ๋œ <Network Flow> ๋ฌธ์ œ๋ฅผ ์‚ดํŽด๋ณด๋ฉด ์ •๋ง ์œ ๋Ÿ‰(Flow)์— ๋Œ€ํ•œ ๋‹น์—ฐํ•œ ์–˜๊ธฐ๋“ค์„ ํ•˜๊ณ  ์žˆ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค. ์ด๋Ÿฐ ๋‹น์—ฐํ•œ ์–˜๊ธฐ๋“ค์ด ์ „๋ถ€ constraint๊ฐ€ ๋œ๋‹ค๋Š”๊ฒŒ ํ ์ด์ง€๋งŒโ€ฆ


Residual Network

<Networ Flow> ๋ฌธ์ œ๋Š” ๊ธฐ์กด์˜ Graph $G$์—์„œ <Residual Network>๋ผ๋Š” ๊ทธ๋ž˜ํ”„๋ฅผ ๊ตฌ์ถ•(construction) ํ•˜๋ฉด์„œ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋‹ค! ๐Ÿ˜‰ ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด ํ•œ๋ฒˆ์— ์ดํ•ด ๋˜์ง€๋Š” ์•Š์œผ๋‹ˆ ์ฃผ์˜ ๊นŠ๊ฒŒ ์‚ดํŽด๋ณด์ž!

Find an $s-t$ path whose edges $(u, v)$ can be of two types:

1. $(u, v) \in E$ and $f_{uv} < c_{uv}$

2. $(v, u) \in E$ and $f_{vu} > 0$

์˜ˆ๋ฅผ ํ†ตํ•ด ์œ„์˜ ๊ทœ์น™์„ ์ดํ•ดํ•ด๋ณด์ž.

์šฐ๋ฆฌ๋Š” ์™ผ์ชฝ์˜ ๊ทธ๋ž˜ํ”„์—์„œ ์‹œ์ž‘ํ•ด ์˜ค๋ฅธ์ชฝ์˜ ๊ฒฐ๊ณผ๋ฅผ ์–ป๊ณ ์ž ํ•œ๋‹ค.

๋จผ์ € ์ฒซ ๋ฒˆ์งธ ๊ทœ์น™์— ๋”ฐ๋ฅด๋ฉด $s-t$ path๋Š” $s \rightarrow a \rightarrow t$, $s \rightarrow b \rightarrow t$ ๋˜๋Š” $s \rightarrow a \rightarrow b \rightarrow t$์˜ ๊ฒฝ๋กœ๋ฅผ ์ฐพ์„ ์ˆ˜ ์žˆ๋‹ค. ์—ฌ๊ธฐ์„œ๋Š” $s \rightarrow a \rightarrow b \rightarrow t$์˜ ๊ฒฝ๋กœ๋กœ flow๋ฅผ ํ˜๋ ค๋ณด๋ƒˆ๋‹ค๊ณ  ํ•˜์ž.

๊ธฐ์กด์˜ ๋ฐฉ์‹์—์„œ๋Š” ๊ฐ€์šด๋ฐ $a \rightarrow b$ ๋ฐฉํ–ฅ์œผ๋กœ flow๋ฅผ ํ˜๋ ค๋ณด๋ƒˆ๊ธฐ ๋•Œ๋ฌธ์— ๋”์ด์ƒ flow๋ฅผ ํ˜๋ ค๋ณด๋‚ผ ๊ฒฝ๋กœ๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š๋Š”๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๋‘ ๋ฒˆ์งธ ๊ทœ์น™์„ ์ ์šฉํ•˜๋ฉด, ์ถ”๊ฐ€๋กœ flow๋ฅผ ํ˜๋ ค๋ณด๋‚ผ ์ˆ˜ ์žˆ๋‹ค!!

๋‘ ๋ฒˆ์งธ ๊ทœ์น™์„ ์ ์šฉํ•˜๋ฉด $s \rightarrow b \rightarrow a \rightarrow t$ ๊ฒฝ๋กœ๋กœ flow๋ฅผ ํ˜๋ ค๋ณด๋‚ผ ์ˆ˜ ์žˆ๋‹ค! ์ด๋•Œ, $b \rightarrow a$๋Š” ๊ธฐ์กด ๊ทธ๋ž˜ํ”„์—๋Š” ์—†๋˜ ๊ฐ„์„ ์ด์ง€๋งŒ, ๋‘ ๋ฒˆ์งธ ๊ทœ์น™์— ์˜ํ•ด $f_{ab} = 1 > 0$์ด๊ธฐ ๋•Œ๋ฌธ์— $(b, a) \in E$์— ๋Œ€ํ•œ edge๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ๋‹ค!!

์ด์ œ, ๊ฒฝ๋กœ $s \rightarrow a \rightarrow b \rightarrow t$์™€ $s \rightarrow b \rightarrow a \rightarrow t$๋ฅผ ์ข…ํ•ฉํ•˜๋ฉด ์šฐ๋ฆฌ๋Š” ์˜ค๋ฅธ์ชฝ์˜ ๊ฒฐ๊ณผ๋ฅผ ์–ป๊ฒŒ ๋˜๋ฉฐ, network์˜ ์ตœ๋Œ€ ์œ ๋Ÿ‰์€ 2๋ผ๋Š” ๊ฒฐ๊ณผ๋ฅผ ์–ป๊ฒŒ ๋œ๋‹ค!


<Network Flow> ์•Œ๊ณ ๋ฆฌ์ฆ˜์—์„œ๋Š” ์œ„์™€ ๊ฐ™์€ ๊ณผ์ •์„ ์ข€๋” ํŽธํ•˜๊ฒŒ ๋‹ค๋ฃจ๊ธฐ ์œ„ํ•ด, $s-t$ ๊ฒฝ๋กœ๋ฅผ ์ฐพ๋Š” ๋งค๋ฒˆ์˜ ๊ณผ์ •์—์„œ <Residual Graph> $G^f = (V, E^f)$๋ผ๋Š” ๊ทธ๋ž˜ํ”„๋ฅผ ๊ฐฑ์‹ ํ•˜๋ฉฐ ์‚ฌ์šฉํ•œ๋‹ค. ์šฐ๋ฆฌ๋Š” Residual Graph $G^f$์—์„œ Network Flow ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•จ์œผ๋กœ์จ ๊ธฐ์กด์˜ ๊ทธ๋ž˜ํ”„ $G$์˜ Network Flow ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋‹ค! ์ฆ‰ $G \equiv G^f$, $G$์™€ $G^f$๊ฐ€ ๋™์น˜์ธ ์…ˆ์ด๋‹ค! ๐Ÿ˜ฒ

<Residual Graph> $G^f$์— ๋Œ€ํ•ด formal ํ•˜๊ฒŒ ๊ธฐ์ˆ ํ•˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

During the algorithm, we maintain a residual graph $G^f = (V, E^f)$, which has two types of edges with residual capacities

\[c^f_{uv} = \begin{cases} c_{uv} - f_{uv} & \text{if} \; (u, v) \in E \; \text{and} \; f_{uv} < c_{uv} \\ f_{vu} & \text{if} \; (v, u) \in E \; \text{and} \; f_{vu} > 0 \; ( \equiv \text{$(u, v)$ is reverse edge}) \end{cases}\]

<Network Flow> ๋ฌธ์ œ๋ฅผ <Residual Network>๋กœ ํ‘ธ๋Š” ๊ฒƒ์€ ์‚ฌ์‹ค Linear Programming์˜ <Simplex Method>๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด๋ผ๊ณ  ํ•œ๋‹ค. ์ด์— ๋Œ€ํ•ด์„œ๋Š” ์ถ”ํ›„์— ๋ณ„๋„์˜ ํฌ์ŠคํŠธ์—์„œ ๋” ์ž์„ธํžˆ ๋‹ค๋ฃจ๋„๋ก ํ•˜๊ฒ ๋‹ค ๐Ÿ˜‰

Residual Flow๋Š” ์ž์—ฐ์Šค๋Ÿฌ์šด ์ ‘๊ทผ์ธ๊ฐ€?

Residual Graph $G^f$ ๊ฐœ๋…์„ ์ฒ˜์Œ ๋ฐฐ์šธ ๋•Œ๋Š” ๊ฐ„์„ ์— ์œ ๋Ÿ‰ $f$๊ฐ€ ํ๋ฅด๋ฉด ๋ฐ˜๋Œ€ํŽธ์— $f$ ๋งŒํผ์˜ capacity๊ฐ€ ์ƒ๊ธด๋‹ค๋Š” ์‚ฌ์‹ค์„ ์ž˜ ์ดํ•ดํ•˜์ง€ ๋ชปํ–ˆ๋‹ค. ๊ทธ๋ƒฅ โ€˜์•„, ๊ทธ๋ƒฅ ํ…Œํฌ๋‹‰์ธ๊ฐ€ ๋ณด๊ตฌ๋‚˜โ€™ํ•˜๊ณ  ๋ฐ›์•„๋“ค์˜€๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ด ๋ถ€๋ถ„ ๋•Œ๋ฌธ์— Network Flow๋ฅผ ์ œ๋Œ€๋กœ ๋ฐ›์•„๋“ค์ด์ง€ ๋ชป ํ•˜๊ณ  ๊ณ„์† ๊ฑท๋Œ๊ณ  ์žˆ์—ˆ๋‹ค. ์ด๋ฒˆ ๋ฌธ๋‹จ์—์„œ๋Š” ๋ณธ์ธ์ด ๋‚˜์ค‘์— ์ดํ•ดํ•˜๊ฒŒ ๋œ Residual Flow๋ฅผ ์ž˜ ์„ค๋ช…ํ•ด๋ณด๋ ค๊ณ  ํ•œ๋‹ค.

๋‹ค์‹œ ์ด๋ฆ„์œผ๋กœ ๋Œ์•„์™€๋ณด์ž. Given graph์—์„œ $s \rightarrow a \rightarrow b \rightarrow t$์˜ ๊ฒฝ๋กœ๋กœ flow๋ฅผ ํ˜๋ ค๋ณด๋‚ด๋ฉด Residual Flow๋ฅผ ์“ฐ์ง€ ์•Š์œผ๋ฉด ๋”์ด์ƒ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์—†์—ˆ๋‹ค. Residual Flow๋ฅผ ์ ์šฉํ•˜๋ฉด $b \rightarrow a$์— capacity $1$์ด ์ถ”๊ฐ€๋˜์–ด $s \rightarrow b \rightarrow a \rightarrow t$๊ฐ€ ๊ฐ€๋Šฅํ•ด์ ธ Final flow๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ $b \rightarrow a$์— capacity $1$์„ ์ถ”๊ฐ€ํ•˜๋Š”๊ฒŒ ๋ง์ด ๋˜๋Š” ๊ฑธ๊นŒ?

๋†€๋ž๊ฒŒ๋„ ๋ง์ด ๋œ๋‹ค! ๋‹ค๋ฅธ ๊ฑด ๋‹ค ์ œ๊ฑฐํ•˜๊ณ  $a \; โ€“ \; b$ ๊ตฌ๊ฐ„๋งŒ ๋ณด์ž. $a \rightarrow b$๋กœ 1๋งŒํผ์˜ ์œ ๋Ÿ‰์ด ํ๋ฅธ๋‹ค๊ณ  ํ•˜์ž. ๊ทธ๋Ÿฐ๋ฐ ์ด๋ ‡๊ฒŒ ์œ ๋Ÿ‰ 1์ด ํ๋ฅด๋Š” ์ƒํƒœ์—์„œ ๋ฐ˜๋Œ€ ๋ฐฉํ–ฅ $a \leftarrow b$๋กœ 1๋งŒํผ์˜ ์œ ๋Ÿ‰์„ ํ˜๋ ค๋ณด๋‚ธ๋‹ค๋ฉด ๋‘ ์œ ๋Ÿ‰์€ ์ƒ์‡„๋˜์–ด 0์ด ๋  ๊ฒƒ์ด๋‹ค. residual flow๋Š” ๋ฐ”๋กœ ์ด๊ฒƒ์„ ๋งํ•œ๋‹ค. ์ด๋ฏธ ๊ฐ„์„ ์— ํ๋ฅด๋Š” flow $f_e$์— ๋Œ€ํ•ด ๊ทธ๊ฑธ ์ƒ์‡„ํ•˜๋Š” ๊ฑด ๊ฐ€๋Šฅํ•˜๋‹ค. ๊ทธ๋ž˜์„œ ๊ทธ๊ฑธ ์ƒ์‡„ํ•˜๋Š” ์–‘์ด ํ๋ฅผ ์ˆ˜ ์žˆ๋„๋ก ๊ธฐ์กด ๊ทธ๋ž˜ํ”„ $G$๋ฅผ ์•ฝ๊ฐ„ ์ˆ˜์ •ํ•˜๋Š” ๊ฑฐ๋‹ค. $c_eโ€™ = f_e$๊ฐ€ ๋˜๋„๋ก ๋ง์ด๋‹ค!

์ด๋Ÿฐ ์ ‘๊ทผ์ด ์ž์—ฐ์Šค๋Ÿฝ๋‹ค๊ณ  ์—ฌ๊ธฐ๊ฒŒ ๋˜๋Š” ์ ์€ residual flow๋Š” ๊ผญ ๊ฐ„์„ ์— ํ๋ฅด๋Š” flow ๋งŒํผ๋งŒ ์ƒ๊ธด๋‹ค๋Š” ๊ฒƒ์ด๋‹ค. ์ด๊ฒƒ์€ ์ด๋ฏธ ํ๋ฅด๋Š” flow $f_e$๋ณด๋‹ค ๋งŽ์€ residual flow๊ฐ€ ํ˜๋Ÿฌ์„œ $f_e$๊ฐ€ ์Œ์ˆ˜๊ฐ€ ๋˜๋Š” ํ˜„์ƒ์„ ๋ฐฉ์ง€ํ•œ๋‹ค. ์ด ์‚ฌ์‹ค๋“ค์„ ์ดํ•ดํ•œ๋‹ค๋ฉด residual flow๋Š” ๊ฝค ์ž์—ฐ์Šค๋Ÿฌ์šด ์ ‘๊ทผ์ด๋ผ๊ณ  ๊นจ๋‹ซ๊ฒŒ ๋  ๊ฒƒ์ด๋‹ค.


Optimality

์œ„์™€ ๊ฐ™์€ ์ ‘๊ทผ๋ฒ•์ด Maximum Flow๋ฅผ ๋ณด์žฅํ•˜๋Š”์ง€๋ฅผ ํ™•์ธํ•ด๋ณด์ž! ์„ค๋ช…์˜ ํŽธ์˜๋ฅผ ์œ„ํ•ด ์ด๋ฏธ Maximum Flow๋ฅผ ๊ตฌํ•œ Residual Graph๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ํ•˜๊ฒ ๋‹ค.

๊ทธ๋ž˜ํ”„ $G$๋ฅผ $s$๋ฅผ ํฌํ•จํ•˜๋Š” $L = \{ s, a, c\}$, $t$๋ฅผ ํฌํ•จํ•˜๋Š” $R=\{ b, d, e, t\}$๋กœ ๋ถ„ํ• ํ•ด๋ณด์ž. ์ด๋ ‡๊ฒŒ vertex set์„ disjoint set $(L, R)$๋กœ ๋ถ„ํ• ํ•˜๋Š” ๊ฒƒ์„ $(s, t)$-cut๋˜๋Š” ๊ฐ„๋‹จํ•˜๊ฒŒ cut์ด๋ผ๊ณ  ํ•œ๋‹ค. ์ด๋•Œ, $L-R$์„ ์ž‡๋Š” edge์˜ ์ง‘ํ•ฉ์„ cut-set๋ผ๊ณ  ํ•˜๋ฉฐ, ์ด cut-set์˜ capacity์˜ ์ดํ•ฉ์ด $(s, t)$-cut์˜ capacity๊ฐ€ ๋œ๋‹ค. ์‚ฌ์‹ค $s$์™€ $t$๋ฅผ disjoint set์œผ๋กœ ๋ถ„ํ• ํ•˜๋Š” ๊ฐ€๋Šฅํ•œ cut์€ ์ •๋ง ๋งŽ๋‹ค. ์ด๋•Œ, minimum cut ์ค„์—ฌ์„œ min-cut์€ cut capacity๊ฐ€ ์ตœ์†Œ๊ฐ€ ๋˜๋Š” cut์„ ๋งํ•œ๋‹ค.

$s \rightarrow t$ ๋ฐฉํ–ฅ์œผ๋กœ ํ๋ฅด๋Š” ๋ชจ๋“  ์œ ๋Ÿ‰(flow)์€ $L$์—์„œ $R$์„ ์ง€๋‚˜์•ผ ํ•œ๋‹ค. ๊ทธ๋Ÿฌ๋ฏ€๋กœ ์–ด๋–ค ์œ ๋Ÿ‰๋„ $L$๊ณผ $R$ ์‚ฌ์ด๋ฅผ ์ž‡๋Š” edge์˜ capacity ๋ณด๋‹ค ํฐ ๊ฐ’์„ ๊ฐ€์งˆ ์ˆ˜ ์—†๋‹ค. ์ด๊ฒƒ์€ ๋„คํŠธ์›Œํฌ์˜ ์œ ๋Ÿ‰(flow)์˜ ์ดํ•ฉ์ด $(s, t)$-cut์˜ capacity๋ฅผ ๋„˜์„ ์ˆ˜ ์—†์Œ์„ ์˜๋ฏธํ•œ๋‹ค.

Lemma 1.

Pick any $(s, t)$-cut $(L, R)$ and any flow $f$, then $\text{size}(f) \le \text{capacity}(L, R)$.

์šฐ๋ฆฌ๋Š” ์•„์ง $G$๋ฅผ ์–ด๋–ป๊ฒŒ ๋ถ„ํ• ํ•ด์•ผ ํ• ์ง€ ์ •ํ•˜์ง€ ์•Š์•˜๋‹ค. ์œ„์˜ ๋ช…์ œ๋Š” ๊ทธ๋ž˜ํ”„๋ฅผ ์–ด๋–ป๊ฒŒ ๋ถ„ํ• ํ•˜๋Š”์ง€์— ์ƒ๊ด€ ์—†์ด ๋„คํŠธ์›Œํฌ์— ํ๋ฅด๋Š” ์ „์ฒด ์œ ๋Ÿ‰์€ $\text{capacity}(L, R)$ ๋„˜์ง€ ๋ชปํ•œ๋‹ค, ์ฆ‰ upper bound๋กœ ๊ฐ€์ง„๋‹ค๋ฅผ ๋งํ•  ๋ฟ์ด๋‹ค.


์ด๋ฒˆ์—๋Š” $(s, t)$-cut์— ํ๋ฅด๋Š” flow์— ๋Œ€ํ•œ Lemma๋ฅผ ์‚ดํŽด๋ณด์ž.

Lemma 2.

\[f(L, R) = f(L \cup \{ v \}, R \setminus \{ v\})\]

For two vertext set $L$ and $R$, $v$ is an element of $R$. Remove $v$ from $R$ and place it in $S$, and now re-evaluate the flow of new cut $(L \cup \{ v\}, R \setminus \{ v \})$.

Letโ€™s define two edge set $\text{In}(v)$ and $\text{Out}(v)$, they are incoming edges and outcoming edges of $v$ each. Then, by the conservation of flow:

\[\sum_{(u, v) \in \text{In}(v)} f(u, v) = \sum_{(v, w) \in \text{Out}(v)} f(v, w)\]

Then, we partition $\text{In}(v)$ and $\text{Out}(v)$ based on where the end points of the edges fall as follows:

\[\begin{aligned} \text{In}(v)_L &= \left\{ (u, v) \in E \mid u \in L \right\} \\ \text{In}(v)_R &= \left\{ (u, v) \in E \mid u \in R \right\} \\ \text{Out}(v)_L &= \left\{ (v, w) \in E \mid w \in L \right\} \\ \text{Out}(v)_R &= \left\{ (v, w) \in E \mid w \in R \right\} \end{aligned}\]

Moving $v$ into $L$ will result in losing $v$โ€™s contribution to the original cut capacity, but also in gaining the capacity of the outgoing edges from $v$ thus:

\[\begin{aligned} &f(L \cup \{ v \}, R \setminus \{ v\}) \\ &= f(L, R) - \sum_{(u, v) \in \text{In}(v)_L} f(u, v) + \sum_{(v, w) \in \text{Out}(v)_L} f(v, w) - \sum_{(u, v) \in \text{In}(v)_R} f(u, v) + \sum_{(v, w) \in \text{Out}(v)_R} f(v, w) \\ &= f(L, R) - \cancel{\left(\sum_{(u, v) \in \text{In}(v)} f(u, v)\right)} + \cancel{\left(\sum_{(v, w) \in \text{Out}(v)} f(v, w)\right)} \\ &= f(L, R) \end{aligned}\]

์œ„์˜ ๊ฒฐ๊ณผ๋Š” ์–ด๋–ค cut์„ ์žก๋“  ์ƒ๊ด€์—†์ด Network์— ํ๋ฅด๋Š” flow์˜ ์ตœ์ข…๊ฐ’์€ ๋ชจ๋‘ ๋™์ผํ•˜๋‹ค๊ณ  ๋งํ•œ๋‹ค! ๊ทธ๋ž˜์„œ ์ด flow์˜ ์ตœ์ข…๊ฐ’์„ value of flow, $\text{val}(f)$๋ผ๊ณ  ๋ถ€๋ฅด๊ฒ ๋‹ค.

\[\text{val}(f) = f(L, R) = f(\{s\}, V \setminus \{s\}) = \sum_{(s, u) \in E} f(s, u)\]

์ด ์‚ฌ์‹ค์„ ๋ฐ”ํƒ•์œผ๋กœ Lemma 1์„ ๋‹ค์‹œ ์“ฐ๋ฉด ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

\[\text{val}(f) \le \text{capacity}(L, R)\]


์•„์ง ํฌ์ŠคํŠธ์—์„œ๋Š” ์•ˆ ๋‹ค๋ค˜์ง€๋งŒ Ford-Fulkerson์„ ์ˆ˜ํ–‰ํ•˜๋ฉฐ Residual Graph $G^f$๋ฅผ ์–ป์—ˆ๋‹ค๊ณ  ํ•ด๋ณด์ž. ๊ทธ๋ฆฌ๊ณ  ๊ทธ๋•Œ์˜ final flow๋ฅผ $f$๋ผ๊ณ  ํ•˜์ž. ๊ทธ๋ ‡๋‹ค๋ฉด ๊ทธ๋ž˜ํ”„ $G^f$ ์•„๋ž˜์—์„œ source $s$๋Š” ๋”์ด์ƒ sink $t$๋กœ reachable ํ•˜์ง€ ์•Š์„ ๊ฒƒ์ด๋‹ค.

$L$์„ ๋…ธ๋“œ $s$์—์„œ reachableํ•œ ๋…ธ๋“œ์˜ ์ง‘ํ•ฉ์œผ๋กœ ์„ค์ •ํ•˜๊ณ , $R$์€ $R = V - L$๋กœ ์„ค์ •ํ•˜์ž. ๊ทธ๋Ÿฌ๋ฉด final flow $f$์— ๋Œ€ํ•ด ์•„๋ž˜๊ฐ€ ์„ฑ๋ฆฝํ•œ๋‹ค!

Lemma 3.

For the residual graph $G^f$ driven by Ford-Fulkerson(simplex method), the following holds

\[\text{size}(f) = \text{capacity}(L, R)\]

Ford-Fulkerson์œผ๋กœ ์œ ๋„๋˜๋Š” $(L, R)$ ๋ถ„ํ• ์— ๋Œ€ํ•ด $\text{size}(f) = \text{capacity}(L, R)$๊ฐ€ ์„ฑ๋ฆฝํ•จ์„ ์ฆ๋ช…ํ•ด๋ณด์ž.

๋จผ์ € $G^f$์˜ $L \rightarrow R$ ๋ฐฉํ–ฅ์˜ edge๋“ค์„ ์‚ดํŽด๋ณด์ž. ์ด๋Ÿฐ edge์— ๋Œ€ํ•ด์„œ๋Š” $f_e = c_e$๋กœ full capacity ๋งŒํผ์˜ flow๊ฐ€ ํ๋ฅธ๋‹ค. ($f_e \ne c_e$๋ผ๋ฉด flow๋ฅผ ๋” ํ˜๋ ค๋ณด๋‚ผ ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— final flow๋ผ๋Š” ๊ฐ€์ •์„ ์œ„๋ฐฐํ•œ๋‹ค.)

๋‹ค์Œ์œผ๋กœ $G^f$์˜ $L \leftarrow R$ ๋ฐฉํ–ฅ์˜ edge๋“ค์„ ์‚ดํŽด๋ณด์ž. ์ด๋Ÿฐ edge์— ๋Œ€ํ•ด์„œ๋Š” flow๊ฐ€ ์ „ํ˜€ ํ๋ฅด์ง€ ์•Š๋Š” $f_{eโ€™} = 0$์ด ๋œ๋‹ค. (๋งŒ์•ฝ $f_{eโ€™} \ne 0$๋ผ๋ฉด $f_{eโ€™}$ ๋งŒํผ ๋ฐ˜๋Œ€ ๋ฐฉํ–ฅ์œผ๋กœ capacity๊ฐ€ ์ƒ๊ธด๋‹ค. ์ด๊ฒƒ์„ ๋”ฐ๋ผ flow๋ฅผ ๋” ํ˜๋ ค๋ณด๋‚ผ ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— final flow ๊ฐ€์ •์„ ์œ„๋ฐฐํ•œ๋‹ค.)

๋”ฐ๋ผ์„œ, Ford-Fulkerson์œผ๋กœ ์œ ๋ž˜๋˜๋Š” $(L, R)$ ๋ถ„ํ•  ์•„๋ž˜์—์„œ๋Š” $\text{size}(f)$๊ฐ€ ์ •ํ™•ํžˆ $L \rightarrow R$ ๋ฐฉํ–ฅ์˜ capacity ๋งŒํผ ํ๋ฅธ๋‹ค! $\blacksquare$


๊ทธ๋ ‡๋‹ค๋ฉด Network Flow ๋ฌธ์ œ์˜ ๋ชฉํ‘œ์ธ Max-Flow๋ฅผ ๋‹ฌ์„ฑํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ์–ด๋–ค $(s, t)$-cut์„ ์žก์•„์•ผ ํ• ๊นŒ? ์•„๋ž˜์˜ ๋ช…์ œ๋Š” Max-Flow๋ฅผ ๋ณด์žฅํ•˜๋Š” $(s, t)$-cut์— ๋Œ€ํ•ด ๊ธฐ์ˆ ํ•˜๊ณ  ์žˆ๋‹ค.

Theorem. Max-flow min-cut theorem (MFMC)

The size of the maximum flow in a network equals the capacity of the smallest $(s, t)$-cut1.

๋˜๋Š” ์ด๋ ‡๊ฒŒ ํ‘œํ˜„ํ•  ์ˆ˜๋„ ์žˆ๋‹ค.

The following statements are equivalent.

  1. $f$ is maximized.
  2. $G^f$ has no augmenting paths.
  3. There exists a cut $(L, R)$ such that $\text{capacity}(L, R) = \text{size}(f)$

์ด <MFMC Theorem>์ด ๋ฌด์—‡์„ ์˜๋ฏธํ•˜๋Š”์ง€ ์‚ดํŽด๋ณด์ž. Lemma 1, 2๋ฅผ ์ข…ํ•ฉํ•ด ์–ป์€ ๊ฒฐ๋ก ์€ ์–ด๋–ค cut $(L, R)$์„ ์žก๋“  ๊ทธ๋•Œ์˜ capacity๋Š” $\text{val}(f)$๋ณด๋‹ค ํฌ๊ฑฐ๋‚˜ ๊ฐ™๋‹ค์ด๋‹ค. <MFMC Theorem>์€ capacity๊ฐ€ ์ตœ์†Œ๊ฐ€ ๋˜๋Š”, ์ฆ‰ $\text{capacity}(L, R) = \text{val}(f)$๊ฐ€ ๋˜๋Š” $(L, R)$ cut์ด ์กด์žฌํ•˜์ง€๋งŒ, ๊ทธ๊ฒƒ์€ ์˜ค์ง $\text{val}(f)$๊ฐ€ ๋„คํŠธ์›Œํฌ์˜ maximum flow์ผ ๋•Œ๋งŒ ์„ฑ๋ฆฝํ•จ์„ ๋งํ•œ๋‹ค! (์ฆ‰, $(3) \implies (1)$๋ผ๋Š” ๋ง์ด๋‹ค.)

MFMC Theorem์ด ๊ธฐ์ˆ ํ•˜๋Š” 3๊ฐ€์ง€ ๋ช…์ œ๊ฐ€ ์„œ๋กœ Equivalent ํ•จ์„ ์ฆ๋ช…ํ•ด๋ณด์ž. ์ฆ๋ช… ์ˆœ์„œ๋Š” $(1) \implies (2)$, $(2) \implies (3)$, $(3) \implies (1)$ ์ˆœ์„œ๋กœ ์ง„ํ–‰ํ•œ๋‹ค.


1. $(1) \implies (2)$

Let $f$ be a max flow, and suppose $G^f$ still has an augmenting path $\mathcal{P}$ (๊ท€๋ฅ˜๋ฒ•). Then we can increase $\text{val}(f)$ by augmenting along the path $\mathcal{P}$. This contradicting the maximality of $f$.

$\therefore$ When the $f$ is maximized, $G^f$ should have no augmenting paths.


2. $(2) \implies (3)$

Suppose $G^f$ has no augmenting paths. Then we can easily construct a cut $(L, R)$ s.t. $\text{capacity}(L, R) = \text{val}(f)$ by the following way: Let $L$ denote the set of vertices reachable from $s$ and for a vertext $v$ if there is an augmenting path from $s$, then $v \in S$. Since $G^f$ has no augmenting $s-t$ path, we know that $t \not\in S$. And let $R$ be the $R = V \setminus L$, then $t \in R$, and this $(L, R)$ is a valid $s-t$ cut. Then, the capacity of $(L, R)$ is exactly the $f$ of the $G^f$. If not, then thereโ€™s more capacity to flow through $L$ to $R$, and it means $G^f$ has an augmenting path! (๊ท€๋ฅ˜๋ฒ•!)


3. $(3) \implies (1)$

Let $(L, R)$ be a cut with $\text{capacity}(L, R) = \text{val}(f)$, and let $fโ€™$ be a maximum flow in $G$, so $\text{val}(f) \le \text{val}(fโ€™)$. Since $\text{val}(f) = \text{capaicty}(L, R)$, then $\text{capacity}(L, R) \le \text{val}(fโ€™)$. However, by the Lemma 1 $\text{val}(fโ€™) \le \text{capacity}(L, R)$.

$\therefore$ $\text{val}(fโ€™) = \text{capacity}(L, R) = \text{val}(f)$. This means the $f$ is the maximum flow!!

$\blacksquare$

์ด๋ ‡๊ฒŒ Residual Graph $G^f$๋ฅผ ๊ตฌ์ถ•ํ•˜๋ฉฐ Maximum Flow๋ฅผ ์ฐพ๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜์œผ๋กœ <Ford-Fulkerson Algorithm>๊ณผ <Edmonds-Karp Algorithm>์ด ์žˆ๋Š”๋ฐ ์œ„์˜ <MFMC Theorem>์€ $(2) \implies (1)$์„ ๋ณด์žฅํ•˜๊ธฐ ๋•Œ๋ฌธ์— Residual Graph $G^f$์—์„œ augmenting path๊ฐ€ ๋”์ด์ƒ ์—†๋Š” ๊ทธ๋•Œ Maximum Flow๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค.


๋งบ์Œ๋ง

์ด๋ฒˆ ํฌ์ŠคํŠธ์—์„œ๋Š” <Network Flow> ๋ฌธ์ œ๋ž€ ๋ฌด์—‡์ธ์ง€ ๊ทธ๋ฆฌ๊ณ  Maximum Flow๋ฅผ ์ฐพ๋Š” ์ ‘๊ทผ๋ฒ•๊ณผ ๊ทธ ๋ฐฉ๋ฒ•์˜ Optimality๋ฅผ ์‚ดํŽด๋ดค๋‹ค. ์•„์ง <Network Flow> ๋ฌธ์ œ์— ๋Œ€ํ•ด์„œ๋Š” ์•„์ง ๋‹ค๋ค„์•ผ ํ•  ๋‚ด์šฉ๋“ค์ด ๋งŽ์ด ๋‚จ์•„์žˆ๋‹ค. ๋‚จ์€ ๋ถ€๋ถ„๋“ค์€ ์ด์–ด์ง€๋Š” Ford-Fulkerson & Edmons-Karp Algorithm ํฌ์ŠคํŠธ์—์„œ ์ด์–ด์„œ ๋‹ค๋ฃจ๋„๋ก ํ•˜๊ฒ ๋‹ค.


references


  1. smallest $(s, t)$-cut, ๋˜๋Š” โ€œmin-cutโ€œ์ด๋ผ๋Š” ๊ฐœ๋…์ด ๋“ฑ์žฅํ•œ๋‹ค. ์ด๊ฒƒ์€ ๊ทธ๋ž˜ํ”„์—์„œ ๊ฐ€๋Šฅํ•œ ๋ชจ๋“  $(s, t)$-cut ์ค‘ capacity๊ฐ€ ๊ฐ€์žฅ ์ž‘์€ cut์„ ์˜๋ฏธํ•œ๋‹ค.ย 

Categories:

Updated: