src/test/dijkstra_test.cc
changeset 1161 1c9658d51c8d
parent 986 e997802b855c
child 1164 80bb73097736
equal deleted inserted replaced
12:0ce40d0cff34 13:9ad66118b621
    15  */
    15  */
    16 
    16 
    17 #include "test_tools.h"
    17 #include "test_tools.h"
    18 #include <lemon/smart_graph.h>
    18 #include <lemon/smart_graph.h>
    19 #include <lemon/dijkstra.h>
    19 #include <lemon/dijkstra.h>
       
    20 #include <lemon/maps.h>
    20 #include <lemon/concept/graph.h>
    21 #include <lemon/concept/graph.h>
    21 #include <lemon/concept/maps.h>
    22 #include <lemon/concept/maps.h>
    22 using namespace lemon;
    23 using namespace lemon;
    23 
    24 
    24 const int PET_SIZE =5;
    25 const int PET_SIZE =5;
    42   Edge e;
    43   Edge e;
    43   VType l;
    44   VType l;
    44   bool b;
    45   bool b;
    45   DType::DistMap d(G);
    46   DType::DistMap d(G);
    46   DType::PredMap p(G);
    47   DType::PredMap p(G);
    47   DType::PredNodeMap pn(G);
    48   //  DType::PredNodeMap pn(G);
    48   LengthMap cap;
    49   LengthMap cap;
    49 
    50 
    50   DType dijkstra_test(G,cap);
    51   DType dijkstra_test(G,cap);
    51 
    52 
    52   dijkstra_test.run(n);
    53   dijkstra_test.run(n);
    54   l  = dijkstra_test.dist(n);
    55   l  = dijkstra_test.dist(n);
    55   e  = dijkstra_test.pred(n);
    56   e  = dijkstra_test.pred(n);
    56   n  = dijkstra_test.predNode(n);
    57   n  = dijkstra_test.predNode(n);
    57   d  = dijkstra_test.distMap();
    58   d  = dijkstra_test.distMap();
    58   p  = dijkstra_test.predMap();
    59   p  = dijkstra_test.predMap();
    59   pn = dijkstra_test.predNodeMap();
    60   //  pn = dijkstra_test.predNodeMap();
    60   b  = dijkstra_test.reached(n);
    61   b  = dijkstra_test.reached(n);
    61 
    62   
    62 }
    63 }
    63 
    64 
    64 int main()
    65 int main()
    65 {
    66 {
    66     
    67     
   113 	    "Wrong distance! Difference: " 
   114 	    "Wrong distance! Difference: " 
   114 	    << std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u) 
   115 	    << std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u) 
   115 			    - cap[e]));
   116 			    - cap[e]));
   116     }
   117     }
   117   }
   118   }
       
   119 
       
   120   
       
   121   {
       
   122     NullMap<Node,Node> myPredNodeMap;
       
   123     dijkstra(G,cap).predNodeMap(myPredNodeMap).run(s);
       
   124   }
       
   125   return 0;
   118 }
   126 }
   119