Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 16th, 2012  |  syntax: None  |  size: 0.99 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. System.ArgumentOutOfRangeException: Argument is out of range. error in a shortest path algorithm
  2. public void dotest()
  3.     {
  4.         List<edge> tlist;
  5.         Int32  x;
  6.         setall();
  7.         Int32 ind;
  8.         foreach (edge e1 in alltest)
  9.         {
  10.             tlist = new List<edge>(alledge);
  11.  
  12.             ind = 0;
  13.             foreach (edge e2 in tlist)
  14.             {
  15.                 if (e2.s == e1.s && e2.d == e1.d)
  16.                 {
  17.                     break;
  18.                 }
  19.                 ind++;
  20.  
  21.  
  22.             }
  23.             tlist.RemoveAt(ind);
  24.  
  25.  
  26.  
  27.             x=shortpath(tlist, start, destination);
  28.             if (x != -1)
  29.                 Console.WriteLine("{0}", x);
  30.             else
  31.                 Console.WriteLine("Infinity");
  32.  
  33.         }
  34.  
  35.  
  36.     }
  37.        
  38. ind = -1;
  39.         foreach (edge e2 in tlist)
  40.         {
  41.             ind++;
  42.             if (e2.s == e1.s && e2.d == e1.d)
  43.             {
  44.                 break;
  45.             }
  46.         }
  47.         if(ind != -1)
  48.             tlist.RemoveAt(ind);