๊ด€๋ฆฌ ๋ฉ”๋‰ด

๋ชฉ๋ก๊ทธ๋ž˜ํ”„ ๊นŠ์ด (1)

Hey Tech

[์ž๋ฃŒ๊ตฌ์กฐ] ๊ทธ๋ž˜ํ”„ ์ž๋ฃŒ๊ตฌ์กฐ์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์ž!(๋…ธ๋“œ, ๊ฐ„์„ , ๋ฃจํŠธ ๋…ธ๋“œ, ๊นŠ์ด, ๋†’์ด, ์ฐจ์ˆ˜)

๋ณธ ํฌ์ŠคํŒ…์—์„œ๋Š” ๊ทธ๋ž˜ํ”„(graph) ์ž๋ฃŒ๊ตฌ์กฐ์— ๋Œ€ํ•ด ์•Œ์•„๋ด…๋‹ˆ๋‹ค. ๊ทธ๋ž˜ํ”„ ์ž๋ฃŒ๊ตฌ์กฐ์˜ ๊ตฌ์„ฑ ๊ทธ๋ž˜ํ”„๋Š” ๊ทธ๋ฆผ 1 ๊ณผ ๊ฐ™์ด ๋…ธ๋“œ(Node)์™€ ๊ฐ„์„ (Edge)์œผ๋กœ ํ‘œํ˜„๋ฉ๋‹ˆ๋‹ค. ์ด๋•Œ ๋…ธ๋“œ๋Š” ์ •์ (Vertext)์ด๋ผ๊ณ ๋„ ๋ถˆ๋ฆฝ๋‹ˆ๋‹ค. ์ผ๋ฐ˜์ ์œผ๋กœ ๋…ธ๋“œ์™€ ๊ฐ„์„ ์€ ๊ฐ๊ฐ ๋„์‹œ์™€ ๋„์‹œ๋ฅผ ์ž‡๋Š” ๋„๋กœ๋ฅผ ์˜ˆ์‹œ๋กœ ๋งŽ์ด ํ‘œํ˜„๋ฉ๋‹ˆ๋‹ค. ์ฆ‰, A ๋„์‹œ(๋…ธ๋“œ)์™€ B ๋„์‹œ(๋…ธ๋“œ)๊ฐ€ ์žˆ์„ ๋•Œ, A ๋„์‹œ์—์„œ B ๋„์‹œ๋กœ ์ด๋™ํ•˜๊ธฐ ์œ„ํ•ด ๋„๋กœ(๊ฐ„์„ )๋ฅผ ๊ฑฐ์นœ๋‹ค๊ณ  ์ƒ๊ฐํ•˜์‹œ๋ฉด ๋…ธ๋“œ์™€ ๊ฐ„์„ ์— ๋Œ€ํ•œ ์ดํ•ด๊ฐ€ ์‰ฌ์šธ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๊ทธ๋ž˜ํ”„ ํƒ์ƒ‰? ๊ทธ๋ž˜ํ”„ ํƒ์ƒ‰์ด๋ž€ ํ•˜๋‚˜์˜ ๋…ธ๋“œ์—์„œ ์‹œ์ž‘ํ•ด์„œ ๋‹ค๋ฅธ ๋…ธ๋“œ๋“ค์„ ๋ฐฉ๋ฌธํ•˜๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ๋…ธ๋“œ ์ธ์ ‘? ๋‘ ๋…ธ๋“œ๊ฐ€ ๊ฐ„์„ ์œผ๋กœ ์—ฐ๊ฒฐ๋˜์–ด ์žˆ๋‹ค๋ฉด, '๋‘ ๋…ธ๋“œ๋Š” ์ธ์ ‘(Adjacent)ํ•ด ์žˆ๋‹ค'๋ผ๊ณ  ๋งํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ž˜ํ”„ ์ž๋ฃŒ๊ตฌ์กฐ ๊ด€๋ จ ์šฉ์–ด ์ •๋ฆฌ ๊ทธ๋ž˜ํ”„(ํŠธ..