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

ÇÑŵ¿   
   Á¶È¸ 5308   Ãßõ 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 4191/5683
2015-12   1493714   ¹é¸Þ°¡
2014-05   4957245   Á¤ÀºÁØ1
2008-12   6729   ¹ÚÁø±¹
2008-12   4908   Á¤¼ºÈÆ
2008-12   4951   Àü»ó¿ì
2008-12   5461   ±èÁ¾±¸
2008-12   5640   ¹ÚÁ¾¿ë
2008-12   5737   °û³ë¼º
2008-12   5225   ±è¿À±Ù
2008-12   7361   °­´ë¼·
2008-12   4923   ±èÀå¿ì
2008-12   8359   ÃÖÀϼ·
2008-12   5371   ¹Úº´Èñ
2008-12   6483   ¹ÚÁø±¹
2008-12   6786   ±è½Â±Ç
2008-12   4674   ¹æÈ¿¹®
2008-12   4737   ÀÌÇöÈ£
2008-12   6006   Á¤¸í±â
2008-12   4989   ·ùÀåÈ£
2008-12   6484   ÇÑâ¼ö
2008-12   4824   À̼ºÁØ
2008-12   5314   À̺¸Çö