COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/work/jacint/prim.cc @ 210:6bc65a8a99c6

Last change on this file since 210:6bc65a8a99c6 was 173:de9849252e78, checked in by jacint, 21 years ago

* empty log message *

File size: 1.3 KB
RevLine 
[173]1#include <iostream>
2#include <fstream>
3
4#include <list_graph.hh>
5#include <dimacs.hh>
6#include <prim.h>
7#include <time_measure.h>
8
9#include <bin_heap.hh>
10#include <fib_heap.h>
11
12using namespace hugo;
13
14int main(int, char **) {
15  typedef ListGraph::NodeIt NodeIt;
16
17  ListGraph G;
18  NodeIt s, t;
19  ListGraph::EdgeMap<int> cap(G);
20  readDimacsMaxFlow(std::cin, G, s, t, cap);
21
22  std::cout << "prim demo ..." << std::endl;
23 
24  double pre_time=currTime();
25    Prim<ListGraph, int, FibHeap<ListGraph::NodeIt, int,
26    ListGraph::NodeMap<int> > > prim_test(G, cap);
27    prim_test.run();
28  double post_time=currTime();
29   
30  std::cout << "running time with fib_heap: "
31            << post_time-pre_time << " sec"<< std::endl;
32 
33  pre_time=currTime();
34  Prim<ListGraph, int, BinHeap<ListGraph::NodeIt, int,
35    ListGraph::NodeMap<int> > > prim_test2(G, cap);
36  prim_test2.run();
37  post_time=currTime();
38 
39  std::cout << "running time with bin_heap: "
40            << post_time-pre_time << " sec"<< std::endl;
41 
42  std::cout<<"A minimalis feszitofa sulya fib kupaccal: "<< prim_test.weight() <<std::endl;
43  std::cout<<"A minimalis feszitofa sulya bin kupaccal: "<< prim_test2.weight() <<std::endl;
44  if ( prim_test.weight() != prim_test2.weight() )
45    std::cout<<"Nem egyezik meg!"<<std::endl;
46  else std::cout<<"Megegyezik."<<std::endl;
47
48  return 0;
49}
Note: See TracBrowser for help on using the repository browser.