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

ÇÑŵ¿   
   Á¶È¸ 5370   Ãßõ 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 4224/5696
2015-12   1566213   ¹é¸Þ°¡
2014-05   5029648   Á¤ÀºÁØ1
2011-01   6935   ÀåÇп±
2015-06   6935   binary
2005-01   6935   È«µ¿±Ç
2007-05   6935   À¯»ç¿ë
2005-02   6936   Á¤Âùȸ
2016-04   6936   ȸ¿øK
2014-11   6936   À¯·Î
2005-01   6936   ¼ÕÀçÁØ
2004-08   6936   ¼ÛÈ­½Ä
2019-03   6937   CPDLC
2016-02   6937   ÃÖµÎÄ¡
2004-12   6937   ±è³«Ã¶
2004-11   6937   ÀÌ°æÁØ
2017-01   6937   ±èµµÇü
2015-01   6937   Æ®¸®
2004-11   6938   ÃÖ¿¬½Â
2004-10   6938   ±è°Ç¿ì
2011-03   6938   ÀÌÁ¤±Ù
2009-02   6938   ±Ç°æ¿­
2005-02   6938   ¹Ú¼º¼®