demo/kruskal_demo.cc
changeset 2362 eb37b9774ef6
parent 1956 a055123339d5
child 2391 14a343be7a5a
equal deleted inserted replaced
7:350776e545bb 8:7ce561504d3f
   104   std::cout << "The weight of the minimum spanning tree is " << 
   104   std::cout << "The weight of the minimum spanning tree is " << 
   105     kruskal(g, edge_cost_map, tree_map)<<std::endl;
   105     kruskal(g, edge_cost_map, tree_map)<<std::endl;
   106 
   106 
   107   int k=0;
   107   int k=0;
   108   std::cout << "The edges of the tree:" ;
   108   std::cout << "The edges of the tree:" ;
   109   for(EdgeIt i(g); i!=INVALID; ++i){
   109   for(EdgeIt i(g); i!=INVALID; ++i)
   110 
       
   111     if (tree_map[i]) { 
   110     if (tree_map[i]) { 
   112       std::cout << g.id(i) <<";";
   111       std::cout << g.id(i) <<";";
   113       ++k;
   112       ++k;
   114     }
   113     }
   115   }
   114 
   116   std::cout << std::endl;
   115   std::cout << std::endl;
   117   std::cout << "The size of the tree is: "<< k << std::endl;
   116   std::cout << "The size of the tree is: "<< k << std::endl;
   118 
   117 
   119 
   118 
   120   // Kruskal with vector;
   119   // Kruskal with vector;