SHARE
TWEET

Untitled

a guest Nov 19th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for (i = 0; i < 9; ++i)
  2.     {
  3.         finished[i].dist = INFINITY;
  4.         finished[i].reached = 0;
  5.     }
  6.  
  7.     finished[s].dist = 0;
  8.     finished[s].reached = 1;
  9.  
  10.     while (finished[e].reached==0)
  11.     {
  12.         for (i = 0; i < 9; ++i)
  13.         {
  14.             if (finished[i].dist != INFINITY && finished[i].reached == 1)
  15.             {
  16.                 for (j = 0; j < 26; ++j)
  17.                 {
  18.                     if (vertexes[j].start == i && (finished[vertexes[j].end].dist > (finished[i].dist + vertexes[j].dist)))
  19.                     {
  20.                             finished[vertexes[j].end].dist = (finished[i].dist + vertexes[j].dist);
  21.                             finished[vertexes[j].end].from = i;
  22.                     }
  23.                 }
  24.  
  25.                 for (j = 0; j < 9; ++j)
  26.                 {
  27.                     if (finished[j].dist != INFINITY)
  28.                     {
  29.                         finished[j].reached = 1;
  30.                     }
  31.                 }
  32.             }
  33.         }
  34.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top