src/work/johanna/kruskal_test.cc
changeset 804 6874a72dbdc5
parent 352 4b89077ab715
equal deleted inserted replaced
4:1d521748ab75 5:59dfb01b5eef
     2 #include <iostream>
     2 #include <iostream>
     3 #include <map>
     3 #include <map>
     4 #include <vector>
     4 #include <vector>
     5 
     5 
     6 #include <kruskal.h>
     6 #include <kruskal.h>
     7 #include <list_graph.h>
     7 #include <hugo/list_graph.h>
     8 
     8 
     9 
     9 
    10 using namespace std;
    10 using namespace std;
    11 using namespace hugo;
    11 using namespace hugo;
    12 
    12 
    69   ECostMap edge_cost_map(G, 2);
    69   ECostMap edge_cost_map(G, 2);
    70   EBoolMap tree_map(G);
    70   EBoolMap tree_map(G);
    71   
    71   
    72 
    72 
    73   cout << "Uniform 2-es koltseggel: " 
    73   cout << "Uniform 2-es koltseggel: " 
    74        << Kruskal_EdgeCostMapIn_BoolMapOut(G, edge_cost_map, tree_map)
    74        << kruskalEdgeMap(G, edge_cost_map, tree_map)
    75        << endl;
    75        << endl;
    76 
    76 
    77 
    77 
    78   edge_cost_map.set(e1, -10);
    78   edge_cost_map.set(e1, -10);
    79   edge_cost_map.set(e2, -9);
    79   edge_cost_map.set(e2, -9);
    87   edge_cost_map.set(e10, -1);
    87   edge_cost_map.set(e10, -1);
    88 
    88 
    89   vector<Edge> tree_edge_vec;
    89   vector<Edge> tree_edge_vec;
    90 
    90 
    91   cout << "Nemkonst koltseggel (-31): "
    91   cout << "Nemkonst koltseggel (-31): "
    92        << Kruskal_EdgeCostMapIn_IteratorOut(G, edge_cost_map,
    92        << kruskalEdgeMap_IteratorOut(G, edge_cost_map,
    93 					    back_inserter(tree_edge_vec))
    93 				     back_inserter(tree_edge_vec))
    94        << endl;
    94        << endl;
    95 
    95 
    96   int i = 1;
    96   int i = 1;
    97   for(vector<Edge>::iterator e = tree_edge_vec.begin();
    97   for(vector<Edge>::iterator e = tree_edge_vec.begin();
    98       e != tree_edge_vec.end(); ++e, ++i) {
    98       e != tree_edge_vec.end(); ++e, ++i) {
    99     cout << i << ". el: " << *e << endl;
    99     cout << i << ". el: " << G.id(*e) << endl;
   100   }
   100   }
   101 
   101 
   102   tree_edge_vec.clear();
   102   tree_edge_vec.clear();
   103 //   SequenceOutput< back_insert_iterator< vector<Edge> > > 
   103 //   SequenceOutput< back_insert_iterator< vector<Edge> > > 
   104 //     vec_filler(back_inserter(tree_edge_vec));
   104 //     vec_filler(back_inserter(tree_edge_vec));
   105 //   cout << "Nemkonst koltseggel tarhatekonyabban: "
   105 //   cout << "Nemkonst koltseggel tarhatekonyabban: "
   106 //        << Kruskal(G,
   106 //        << Kruskal(G,
   107 // 		  KruskalMapVec<ECostMap>(G, edge_cost_map),
   107 // 		  KruskalMapVec<ECostMap>(G, edge_cost_map),
   108 // 		  vec_filler)
   108 // 		  vec_filler)
   109 //        << endl;
   109 //        << endl;
   110   cout << "Nemkonst koltseggel tarhatekonyabban: "
       
   111        << Kruskal(G,
       
   112 		  KruskalMapVec<ECostMap>(G, edge_cost_map),
       
   113 		  makeSequenceOutput(back_inserter(tree_edge_vec))
       
   114 		  )
       
   115        << endl;
       
   116 
   110 
   117   i = 1;
   111 //   cout << "Nemkonst koltseggel tarhatekonyabban: "
   118   for(vector<Edge>::iterator e = tree_edge_vec.begin();
   112 //        << kruskal(G,
   119       e != tree_edge_vec.end(); ++e, ++i) {
   113 // 		  KruskalMapVec<ECostMap>(G, edge_cost_map),
   120     cout << i << ". el: " << *e << endl;
   114 // 		  makeSequenceOutput(back_inserter(tree_edge_vec))
   121   }
   115 // 		  )
       
   116 //        << endl;
   122 
   117 
       
   118 //   i = 1;
       
   119 //   for(vector<Edge>::iterator e = tree_edge_vec.begin();
       
   120 //       e != tree_edge_vec.end(); ++e, ++i) {
       
   121 //     cout << i << ". el: " << *e << endl;
       
   122 //   }
       
   123 
       
   124 // **********************************************************************
   123 
   125 
   124 //   typedef MinCostTreeKruskal<ListGraph, ECostMap, EBoolMap> MCTK;
   126 //   typedef MinCostTreeKruskal<ListGraph, ECostMap, EBoolMap> MCTK;
   125 
   127 
   126 //   MCTK mctk(G, edge_cost_map, tree_map);
   128 //   MCTK mctk(G, edge_cost_map, tree_map);
   127 //   double k0lts = mctk.run();
   129 //   double k0lts = mctk.run();