test/kruskal_test.cc
changeset 175 4eb8900a865c
parent 103 b68a7e348e00
child 209 765619b7cbb2
equal deleted inserted replaced
0:2aa8705cad7f 1:75feb6ecca2d
    26 
    26 
    27 #include <lemon/concepts/maps.h>
    27 #include <lemon/concepts/maps.h>
    28 #include <lemon/concepts/digraph.h>
    28 #include <lemon/concepts/digraph.h>
    29 #include <lemon/concepts/graph.h>
    29 #include <lemon/concepts/graph.h>
    30 
    30 
    31 
       
    32 using namespace std;
    31 using namespace std;
    33 using namespace lemon;
    32 using namespace lemon;
    34 
    33 
    35 void checkCompileKruskal()
    34 void checkCompileKruskal()
    36 {
    35 {
    55   std::vector<concepts::Digraph::Arc> ws;
    54   std::vector<concepts::Digraph::Arc> ws;
    56   std::vector<concepts::Graph::Edge> uws;
    55   std::vector<concepts::Graph::Edge> uws;
    57 
    56 
    58   kruskal(g, r, ws.begin());
    57   kruskal(g, r, ws.begin());
    59   kruskal(ug, ur, uws.begin());
    58   kruskal(ug, ur, uws.begin());
    60 
       
    61 }
    59 }
    62 
    60 
    63 int main() {
    61 int main() {
    64 
    62 
    65   typedef ListGraph::Node Node;
    63   typedef ListGraph::Node Node;
    95   
    93   
    96 
    94 
    97   //Test with const map.
    95   //Test with const map.
    98   check(kruskal(G, ConstMap<ListGraph::Edge,int>(2), tree_map)==10,
    96   check(kruskal(G, ConstMap<ListGraph::Edge,int>(2), tree_map)==10,
    99 	"Total cost should be 10");
    97 	"Total cost should be 10");
   100   //Test with a edge map (filled with uniform costs).
    98   //Test with an edge map (filled with uniform costs).
   101   check(kruskal(G, edge_cost_map, tree_map)==10,
    99   check(kruskal(G, edge_cost_map, tree_map)==10,
   102 	"Total cost should be 10");
   100 	"Total cost should be 10");
   103 
   101 
   104   edge_cost_map.set(e1, -10);
   102   edge_cost_map.set(e1, -10);
   105   edge_cost_map.set(e2, -9);
   103   edge_cost_map.set(e2, -9);