COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/work/jacint/prim.cc @ 947:93e9c45703ea

Last change on this file since 947:93e9c45703ea was 921:818510fa3d99, checked in by Alpar Juttner, 20 years ago

hugo -> lemon

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