test/dijkstra_test.cc
changeset 287 bb40b6db0a58
parent 278 931190050520
child 293 47fbc814aa31
equal deleted inserted replaced
6:e687d36ddf59 7:d93abfad0b41
    20 #include <lemon/smart_graph.h>
    20 #include <lemon/smart_graph.h>
    21 #include <lemon/list_graph.h>
    21 #include <lemon/list_graph.h>
    22 #include <lemon/lgf_reader.h>
    22 #include <lemon/lgf_reader.h>
    23 #include <lemon/dijkstra.h>
    23 #include <lemon/dijkstra.h>
    24 #include <lemon/path.h>
    24 #include <lemon/path.h>
       
    25 #include <lemon/bin_heap.h>
    25 
    26 
    26 #include "graph_test.h"
    27 #include "graph_test.h"
    27 #include "test_tools.h"
    28 #include "test_tools.h"
    28 
    29 
    29 using namespace lemon;
    30 using namespace lemon;
    53 {
    54 {
    54   typedef int VType;
    55   typedef int VType;
    55   typedef concepts::Digraph Digraph;
    56   typedef concepts::Digraph Digraph;
    56   typedef concepts::ReadMap<Digraph::Arc,VType> LengthMap;
    57   typedef concepts::ReadMap<Digraph::Arc,VType> LengthMap;
    57   typedef Dijkstra<Digraph, LengthMap> DType;
    58   typedef Dijkstra<Digraph, LengthMap> DType;
       
    59   typedef Digraph::Node Node;
       
    60   typedef Digraph::Arc Arc;
    58 
    61 
    59   Digraph G;
    62   Digraph G;
    60   Digraph::Node n;
    63   Node s, t;
    61   Digraph::Arc e;
    64   Arc e;
    62   VType l;
    65   VType l;
    63   bool b;
    66   bool b;
    64   DType::DistMap d(G);
    67   DType::DistMap d(G);
    65   DType::PredMap p(G);
    68   DType::PredMap p(G);
    66   LengthMap length;
    69   LengthMap length;
       
    70   Path<Digraph> pp;
    67 
    71 
    68   DType dijkstra_test(G,length);
    72   {
       
    73     DType dijkstra_test(G,length);
    69 
    74 
    70   dijkstra_test.run(n);
    75     dijkstra_test.run(s);
       
    76     dijkstra_test.run(s,t);
    71 
    77 
    72   l  = dijkstra_test.dist(n);
    78     l  = dijkstra_test.dist(t);
    73   e  = dijkstra_test.predArc(n);
    79     e  = dijkstra_test.predArc(t);
    74   n  = dijkstra_test.predNode(n);
    80     s  = dijkstra_test.predNode(t);
    75   d  = dijkstra_test.distMap();
    81     b  = dijkstra_test.reached(t);
    76   p  = dijkstra_test.predMap();
    82     d  = dijkstra_test.distMap();
    77   b  = dijkstra_test.reached(n);
    83     p  = dijkstra_test.predMap();
       
    84     pp = dijkstra_test.path(t);
       
    85   }
       
    86   {
       
    87     DType
       
    88       ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
       
    89       ::SetDistMap<concepts::ReadWriteMap<Node,VType> >
       
    90       ::SetProcessedMap<concepts::WriteMap<Node,bool> >
       
    91       ::SetStandardProcessedMap
       
    92       ::SetOperationTraits<DijkstraWidestPathOperationTraits<VType> >
       
    93       ::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
       
    94       ::SetStandardHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
       
    95       ::Create dijkstra_test(G,length);
    78 
    96 
    79   Path<Digraph> pp = dijkstra_test.path(n);
    97     dijkstra_test.run(s);
       
    98     dijkstra_test.run(s,t);
       
    99 
       
   100     l  = dijkstra_test.dist(t);
       
   101     e  = dijkstra_test.predArc(t);
       
   102     s  = dijkstra_test.predNode(t);
       
   103     b  = dijkstra_test.reached(t);
       
   104     pp = dijkstra_test.path(t);
       
   105   }
       
   106 
    80 }
   107 }
    81 
   108 
    82 void checkDijkstraFunctionCompile()
   109 void checkDijkstraFunctionCompile()
    83 {
   110 {
    84   typedef int VType;
   111   typedef int VType;