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

ÇÑŵ¿   
   Á¶È¸ 5321   Ãßõ 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 4551/5686
2014-05   4978879   Á¤ÀºÁØ1
2015-12   1514997   ¹é¸Þ°¡
2004-08   7506   ÇÑâȣ
2005-04   5753   ÀüÈ£½Ä
2008-11   5322   ÇÑŵ¿
2006-05   5577   ¼­ÅÂÈñ
2006-05   5586   ¹ÚÁ¤±æ
2004-07   8383   ±è±â¹ü
2007-03   5441   ±è¿ë¼ö_
2007-03   4668   Àü´ë¼®
2004-08   7101   Á¤È«´ë
2005-03   6592   ¾ÈâÁØ
2005-03   6400   ·ùÀåÈ£
2002-07   13383   ¹Ú°æÈ£
2003-01   10067   ±èÀç½Ä
2005-12   5207   ¾ÈâÇö
2006-02   6028   ¼ÛÀçÈÆ
2003-10   9126   Á¤ÀçÈÆ
2004-06   7467   Á¤¸¢
2003-03   10537   ½ÅÁø¿ì
2005-12   5600   Á¤¼ºÈÆ
2007-04   4763   Çѵ¿ÈÆ