¾Ë°í¸®ÁòÀ» ÀÚ¹Ù·Î Ç®´Ù°¡ ¸·Çû½À´Ï´Ù.

ÇÑŵ¿   
   Á¶È¸ 5369   Ãßõ 8    

shortestPath(v, weight, n)

     // v´Â ½ÃÀÛÁ¡, weight´Â °¡ÁßÄ¡ ÀÎÁ¢ Çà·Ä, nÀº Á¤Á¡¼ö

     // create S[n], Dist[n]

   for (i¬0; i<n; i¬i+1) do {

         S[i] ¬ false;  // S¸¦ ÃʱâÈ­

         Dist[i] ¬ weight[v, i];  // Dist¸¦ ÃʱâÈ­

   }

   S[v] ¬ true;

   Dist[v] ¬ 0;

   for (i¬0; i<n-2; i¬i+1) do {  // n-2¹ø ¹Ýº¹

         select u such that  // »õ·Î¿î ÃÖ´Ü °æ·Î¸¦ ¼±Á¤

               Dist[u] = min{Dist[j] | S[j] = false and 0¡Âj<n};  

         S[u] ¬ true;

         for (w¬0; w<n; w¬w+1) do {  // È®Á¤ÀÌ ¾ÈµÈ °æ·Îµé¿¡ ´ëÇØ ´Ù½Ã °è»ê

               if (S[w] = false) then {

                     if (Dist[w] > (Dist[u] + weight[u, w])

                           then Dist[w] ¬ Dist[u] + weight[u, w];

   }}}

end shortestPath




==================================================================================

À§¿¡°É º¸°í ÀÚ¹Ù·Î º¯È¯À» Çϴµ¥

select u such that Àú ºÎºÐÀ» ¾î¶»°Ô º¯È¯ÇؾߵÉÁö ¸ð¸£°Ú½À´Ï´Ù.

¿äºÎºÐ¸¸ ÇØ°áÇÏ¸é µÉµíÇѵ¥ ÀÚ¹Ù¸¦ ´Ù ¾È¹è¿ì°í ¾Ë°í¸®ÁòÀ» ÇÏ´ÂÁö¶ó... Àß ¸ð¸£°Ú½À´Ï´Ù.

¾Ë·ÁÁÖ½Ã¸é °¨»çÇÏ°Ú½À´Ï´Ù.
ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.


QnA
Á¦¸ñPage 3138/5696
2015-12   1565506   ¹é¸Þ°¡
2014-05   5028922   Á¤ÀºÁØ1
2005-08   5370   ÃÖâÇö
2008-11   5370   ÇÑŵ¿
2018-06   5370   DoubleSH
2005-11   5370   ±è¸í¿í
2015-11   5370   ȲȥÀ»ÇâÇØ
2006-03   5370   ½É±Ô»ó
2006-11   5370   ¿ì½Â¿±
2016-04   5370   ¹æoÈ¿o¹®
2005-10   5370   ±èÀÍÅÂ
2006-02   5370   ±èÈ«±æ
2009-01   5370   ÁÖÀç³²
2007-12   5370   ¼­¿ëȯ
2013-02   5370   Áö´Ïº¸ÀÌ
2016-01   5370   °ú°ÅÁö»ç
2007-07   5370   ¹èÁؼ®
2006-07   5370   ¹Ú¸í±Ù
2007-07   5371   ³²±ÃÀϳ²
2014-10   5371   ¹Ú¼º¸¸
2008-07   5371   ±èµ¿¼ö
2006-02   5371   ÃÖâÇö