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

ÇÑŵ¿   
   Á¶È¸ 5387   Ãßõ 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 3140/5700
2015-12   1580688   ¹é¸Þ°¡
2014-05   5044283   Á¤ÀºÁØ1
2015-04   5383   ±¸¸í¼­
2006-08   5383   Á¶À翵
2005-11   5383   ÀåÇö¸ð
2006-10   5383   ¹è±Í¿µ
2006-09   5383   ¾ç±¹Çü
2005-09   5384   ¹®Áö¼º
2008-01   5384   ±èÇö¿ì
2018-04   5384   º°È¥
2008-01   5384   ¿ì½Â¿±
2020-07   5384   FloppyDiskette
2006-04   5384   ±èÁ¤È£
2006-08   5384   Çã¿í
2006-05   5384   ±èÇö¸ñ
2014-02   5384   ±è»ó¹Î
2005-10   5384   ±ÇÇõÀÏ
2008-04   5384   Á¶¸í¼ö
2014-05   5384   ¹Î°¡³ð
2007-05   5384   À±È£¿ë
2016-09   5384   Àº¼­¾Æºü
2009-06   5384   ¹Ì´ã