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

1 minute read

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

<์ตœ๋‹จ๊ฒฝ๋กœ(shortest path)>๋ผ๋Š” ์ฃผ์ œ๋กœ ์ƒ๊ฐํ•ด๋ณผ ์ˆ˜ ์žˆ๋Š” ์—ฌ๋Ÿฌ ๊ฒฝ์šฐ๋ฅผ ์ •๋ฆฌํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค ๐Ÿ˜Ž


Source And Destination

  1. Single source and single destination shortest path problem
  2. Single source shortest path problem
  3. Single destination shortest path problem
  4. All pairs shortest path problem

1. Single source and single destination shortest path problem

๊ฐ„๋‹จํ•˜๋‹ค. ๊ทธ๋ƒฅ <Dijkstra Algorithm>์œผ๋กœ ํ•ด๊ฒฐํ•˜๋ฉด ๋œ๋‹ค ๐Ÿ˜‰

์‚ฌ์‹ค 2๋ฒˆ์งธ ์ผ€์ด์Šค์ธ โ€œSingle source shortest path problemโ€๋„ <Dijkstra Algorithm>์„ ๋Œ๋ฆฌ๋ฉด ๋œ๋‹ค ใ…‹ใ…‹ใ…‹


3. Single destination shortest path problem

์‚ฌ์‹ค ์ด๊ฒƒ๋„ <Dijkstra Algorithm>์œผ๋กœ ํ•ด๊ฒฐ ๋œ๋‹ค ใ…‹ใ…‹ใ…‹ ๊ทธ๋ž˜ํ”„์˜ directed edge์˜ ๋ฐฉํ–ฅ์„ ๋ชจ๋‘ ๋ฐ˜๋Œ€๋กœ ๋ฐ”๊พผ ํ›„, destination์„ ์ถœ๋ฐœ์ ์œผ๋กœ ์‚ผ์•„์„œ โ€œ2. single source shortest path problemโ€์„ ํ’€๋ฉด ๋œ๋‹ค! ๐Ÿ˜‰


4. All pairs shortest path problem

์ด ๋…€์„์€ <Dijkstra Algorithm>์ด ์•„๋‹Œ <Floyd-Warshall Algorithm>์œผ๋กœ ํ’€์–ด์•ผ ํ•œ๋‹ค! DP๋กœ ๊ตฌํ˜„ํ•˜๋ฉฐ, ์ž์„ธํ•œ ๋‚ด์šฉ์„ ํฌ์ŠคํŠธ๋ฅผ ์ฝ์–ด๋ณด์ž! ๐ŸŽˆ


(โ€œShortest Path์— ์ œ์•ฝ ์กฐ๊ฑด์ด ๋“ค์–ด๊ฐ„ ๊ฒฝ์šฐโ€๋Š” ์ถ”ํ›„ ์ถ”๊ฐ€ ์˜ˆ์ • ๐ŸŽˆ)

Categories:

Updated: