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

4 minute read

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

Kruskalโ€™s Algorithm & Primโ€™s Algorithm์—์„œ ์ด์–ด์ง€๋Š” ํฌ์ŠคํŠธ์ž…๋‹ˆ๋‹ค.


<clustering>์ด๋ž€ ์ฃผ์–ด์ง„ $n$๊ฐœ์˜ ๋Œ€์ƒ์„ ์„œ๋กœ ๊ด€๋ จ์žˆ๋Š” ๊ฒƒ๋ผ๋ฆฌ ๋ฌถ์–ด ๊ทธ๋ฃนํ™” ํ•˜๋Š” ๊ฒƒ์„ ๋งํ•œ๋‹ค. ๊ทธ๋ž˜์„œ $k$-clustering์ด๋ผ ํ•˜๋ฉด $n$๊ฐœ ๋Œ€์ƒ์„ $k$๊ฐœ์˜ non-empty group์œผ๋กœ ๋ถ„ํ• ํ•˜๋Š” ๊ฒƒ์„ ๋งํ•œ๋‹ค.

๊ทธ๋Ÿฐ๋ฐ ์–ด๋–ค clustering์ด ์ข‹์€ clustering์ผ๊นŒ? ๋ณดํ†ต์€ ๊ด€๋ จ ์žˆ๋Š” ๊ฒƒ๋ผ๋ฆฌ๋Š” ๊ฐ€๊น๊ฒŒ ๋˜ ๊ด€๋ จ ์—†๋Š” ๊ฒƒ๋ผ๋ฆฌ๋Š” ๋ฉ€๊ฒŒ ํ•˜๋Š” clustering์„ โ€˜์ข‹์€ clusteringโ€™์ด๋ผ๊ณ  ํ•œ๋‹ค. ์ด โ€˜๊ด€๋ จ๋จ(coherence) ๋ฅผ ์ˆ˜์น˜์ ์œผ๋กœ ํ‘œํ˜„ํ•˜๊ธฐ ์œ„ํ•ด์„œ <distance function>๊ณผ <spacing>์ด๋ผ๋Š” ๊ฐœ๋…์ด ๋“ฑ์žฅํ•œ๋‹ค.

<distance function>์€ ๋‘ ๋ฌผ์ฒด ์‚ฌ์ด์˜ ๊ฑฐ๋ฆฌ๋ฅผ ์ธก์ •ํ•˜๋Š” ํ•จ์ˆ˜์ด๋‹ค. ์šฐ๋ฆฌ๋Š” ๊ฑฐ๋ฆฌ๊ฐ€ ๊ฐ€๊นŒ์šธ ์ˆ˜๋ก coherent ํ•˜๋‹ค๊ณ  ํŒ๋‹จํ•œ๋‹ค. <distance function>์œผ๋กœ๋Š” Euclide distance๋‚˜ $L_1$ distance ๋“ฑ์ด ๋Œ€ํ‘œ์ ์ด๋‹ค.

์šฐ๋ฆฌ๋Š” ๋‘ ํด๋Ÿฌ์Šคํ„ฐ ์‚ฌ์ด์—์„œ๋„ ๊ฑฐ๋ฆฌ๋ฅผ ๋งค๊ธธ ์ˆ˜ ์žˆ๋Š”๋ฐ, ์ด๊ฒƒ์„ cluster distance๋ผ๊ณ  ํ•˜์ž. ์ด๊ฒƒ์€ ๋‘ ํด๋Ÿฌ์Šคํ„ฐ $C_1$, $C_2$์— ๊ฐ๊ฐ ์†ํ•˜๋Š” ๋‘ ์ ์— ๋Œ€ํ•ด ๊ฑฐ๋ฆฌ๋ฅผ ์ธก์ •ํ–ˆ์„ ๋•Œ ๊ฐ€์žฅ ๊ฐ€๊นŒ์šด ๊ฑฐ๋ฆฌ๋ฅผ ์˜๋ฏธํ•œ๋‹ค. ์ˆ˜์‹์œผ๋กœ ์ ์œผ๋ฉด

\[\text{cluster dist}(C_1, C_2) = \min_{p_i, \; p_j} \, \text{dist}(p_i, p_j) \quad \text{where} \; p_i \in C_1, \; p_j \in C_2\]

์ด์ œ <spacing>์„ ์ •์˜ํ•ด๋ณด์ž. <spacing>์€ ํด๋Ÿฌ์Šคํ„ฐ ์‚ฌ์ด์˜ cluster distance ์ค‘ ๊ฐ€์žฅ ์ž‘์€ distance๋ฅผ ๋งํ•œ๋‹ค.

\[\text{spacing} = \min_{C_a, \, C_b} \; \text{cluster dist} (C_a, C_b)\]

๋‹ค์‹œ ๋ณธ๋ก ์œผ๋กœ ๋Œ์•„์™€์„œ โ€˜์ข‹์€ clusteringโ€™์ด๋ž€ ๋ฌด์—‡์ผ๊นŒ? ์šฐ๋ฆฌ๋Š” ์ด๊ฒƒ์„ ๊ฐ€๋Šฅํ•œ ๋ชจ๋“  $k$-clustering ์ค‘์—์„œ maximum spacing์„ ๊ฐ€์ง€๋Š” cluster๋ฅผ ๊ฐ€์žฅ ์ข‹์€ clustering์ด๋ผ๊ณ  ์ •ํ•  ๊ฒƒ์ด๋‹ค. ์ด๊ฒƒ์ด ์ด๋ฒˆ ํฌ์ŠคํŠธ์˜ ์ฃผ์ œ โ€œclustering of max. spacingโ€œ์ด๋‹ค ๐Ÿ‘


๊ทธ๋ ‡๋‹ด โ€œclustering of max. spacingโ€œ๋ฅผ ์–ด๋–ป๊ฒŒ ์ฐพ์„ ์ˆ˜ ์žˆ์„๊นŒ? Brute Forceํ•˜๊ฒŒ ์ ‘๊ทผํ•œ๋‹ค๋ฉด ๋‹น์—ฐํžˆ ์กฐํ•ฉ ํญ๋ฐœ์„ ๊ฒฝํ—˜ํ•  ๊ฒƒ์ด๋‹ค. ์ด๋•Œ, ์ข‹์€ ์ •๋ฆฌ๊ฐ€ ์žˆ๋Š”๋ฐ MST์—์„œ ๊ฐ€์žฅ ๋น„์‹ผ ๊ฐ„์„  $k-1$๊ฐœ๋ฅผ ์‚ญ์ œํ•˜๋ฉด $k$-clustering of max. spacing์„ ์–ป์„ ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฒƒ์ด๋‹ค!

Theorem.

Let $C^{*}$ denote the clustering $C_1^{*}, โ€ฆ, C_k^{*}$ formed by delete the $k-1$ most expensive edges of a MST. Then, $C^{*}$ is a $k$-clustering of max. spacing.

proof. (๊ท€๋ฅ˜๋ฒ•)

clustering $C^{*}$์˜ spacing $d^{*}$๋Š” MST์˜ $(k-1)$๋ฒˆ์งธ๋กœ ๋น„์‹ผ ๊ฐ„์„ ์ผ ๊ฒƒ์ด๋‹ค. ์šฐ๋ฆฌ๋Š” optimal clustering $C$๊ฐ€ ์žˆ์–ด ๊ทธ ๋•Œ์˜ spacing์ด $d \ge d^{*}$๋ผ๊ณ  ํ•˜์ž.

$C^{*}$์˜ clustering ์ค‘ ํ•˜๋‚˜์ธ $C_r^{*}$์— ์†ํ•œ ๋‘ ์  $p_i$, $p_j$์— ๋Œ€ํ•ด ์‚ดํŽด๋ณด์ž. ๊ทธ๋Ÿฐ๋ฐ ์ด ๋‘ ์ ์ด $C$์—์„œ๋Š” $C_s$, $C_t$์— ์†ํ•ด ์„œ๋กœ ๋ถ„๋ฆฌ๋œ ์ƒํƒœ๋ผ๊ณ  ํ•˜์ž. ์ฆ‰, $p_i \in C_s$, $p_j \in C_t$์ธ ๊ฒƒ์ด๋‹ค.

$C_r^{*}$ ์œ„์—์„œ $p_i$์—์„œ $p_j$๋กœ ๊ฐ€๋Š” ๊ฒฝ๋กœ๋ฅผ ์ƒ๊ฐํ•ด๋ณด์ž. ์ด๋•Œ ์ค‘๊ฐ„์˜ ์–ด๋–ค ๊ฐ„์„  $(p, q)$๋Š” $C$์—์„œ์˜ ๋‘ ํด๋Ÿฌ์Šคํ„ฐ $C_s$, $C_r$๋ฅผ ๊ฐ€๋ฅด๋Š” clustrer distance๊ฐ€ ๋  ๊ฒƒ์ด๋‹ค. $p_i \rightarrow p_j$ ๊ฒฝ๋กœ์˜ ๋ชจ๋“  ๊ฐ„์„ ์€ MST์˜ ์ •์˜์— ๋”ฐ๋ผ $(k-1)$๋ฒˆ์งธ ๊ฐ„์„ ์ธ $d^{*}$์˜ ๊ธธ์ด๋ณด๋‹ค๋Š” ์ž‘์„ ๊ฒƒ์ด๋‹ค. ๋”ฐ๋ผ์„œ

\[\left| pq \right| \le d^{*}\]

์–ด๋ผ! $C$์„ ์ •์˜ํ•  ๋•Œ spacing $d$๊ฐ€ $d \ge d^{*}$๋ผ๊ณ  ์ •์˜ํ–ˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ $C$์— ์•Œ๊ณ ๋ณด๋‹ˆ $\left| pq \right| \le d^{*}$์ธ cluster distance $\left| pq \right|$๊ฐ€ ์กด์žฌํ–ˆ๋‹ค. ์ด๊ฒƒ์€ ๊ณง $d > d^{*}$๊ฐ€ ๋ถˆ๊ฐ€๋Šฅํ•จ์„ ์˜๋ฏธํ•œ๋‹ค. ๋”ฐ๋ผ์„œ $d = d^{*}$์ด๋ฏ€๋กœ MST๋กœ๋ถ€ํ„ฐ ์œ ๋„ํ•œ clustering $C^{*}$์€ clustering of max. spacing์ด๋‹ค! $\blacksquare$


์ด๊ฒƒ์œผ๋กœ ์ •๊ทœ์ˆ˜์—…์—์„œ ๋‹ค๋ฃฌ ๋ชจ๋“  <Greedy Algorithm> ๋ฌธ์ œ๋ฅผ ์‚ดํŽด๋ณด์•˜๋‹ค. ๐Ÿ‘

Categories:

Updated: