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

ÇÑŵ¿   
   Á¶È¸ 5326   Ãßõ 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 4550/5687
2014-05   4990397   Á¤ÀºÁØ1
2015-12   1526385   ¹é¸Þ°¡
2007-05   6397   °­Çö¼·
2007-10   5118   ¹ÚÇö±Ù
2005-04   5797   À±¿µ¹è
2002-08   12027   ±èºÀ¼ö
2005-07   5851   ÃÖâÇö
2005-12   5248   ±è´ë¼º
2006-01   5460   ¹ÚÁØ¿ë
2004-02   8846   ±èÇÑÁØ
2004-06   7530   ¿À°æ
2007-05   4815   À̸íÈÆ
2008-01   5465   Á¶ÀçÇö
2005-05   5268   ¹è¼ºÈ£
2006-04   5472   ¹éÂù¿ë
2003-11   12286   ¹®º´Ã¤
2007-02   4606   À̸íÈÆ
2004-10   6820   ±èÇÑÁØ
2004-12   6734   ±èÇÑÁØ
2007-10   6643   ¼Õ°æÈ­
2002-10   12791   °ûµ¿Çö
2006-08   4908   À̹®Èì