COIN-OR::LEMON - Graph Library

Changeset 211:9222a9b8b323 in lemon-0.x for src/work/jacint/dijkstra.cc


Ignore:
Timestamp:
03/19/04 23:16:05 (17 years ago)
Author:
jacint
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@306
Message:

updating

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/jacint/dijkstra.cc

    r173 r211  
    22#include <fstream>
    33
    4 #include <list_graph.hh>
    5 #include <dimacs.hh>
     4#include <smart_graph.h>
     5#include <list_graph.h>
     6#include <dimacs.h>
    67#include <dijkstra.h>
    78#include <time_measure.h>
     
    1314
    1415int main(int, char **) {
    15   typedef ListGraph::NodeIt NodeIt;
    16   typedef ListGraph::EachNodeIt EachNodeIt;
    17   typedef ListGraph::InEdgeIt InEdgeIt;
     16  typedef SmartGraph::Node Node;
     17  typedef SmartGraph::NodeIt NodeIt;
     18  typedef SmartGraph::InEdgeIt InEdgeIt;
    1819
    19   ListGraph G;
    20   NodeIt s, t;
    21   ListGraph::EdgeMap<int> cap(G);
     20  SmartGraph G;
     21  Node s, t;
     22  SmartGraph::EdgeMap<int> cap(G);
    2223  readDimacsMaxFlow(std::cin, G, s, t, cap);
    2324
     
    2526 
    2627  double pre_time=currTime();
    27     Dijkstra<ListGraph, int, FibHeap<ListGraph::NodeIt, int,
    28     ListGraph::NodeMap<int> > > dijkstra_test(G, s, cap);
    29     dijkstra_test.run();
     28    Dijkstra<SmartGraph, int, FibHeap<SmartGraph::Node, int,
     29    SmartGraph::NodeMap<int> > > dijkstra_test(G, cap);
     30    dijkstra_test.run(s);
    3031  double post_time=currTime();
    3132   
     
    3435 
    3536  pre_time=currTime();
    36   Dijkstra<ListGraph, int, BinHeap<ListGraph::NodeIt, int,
    37     ListGraph::NodeMap<int> > > dijkstra_test2(G, s, cap);
    38   dijkstra_test2.run();
     37  Dijkstra<SmartGraph, int, BinHeap<SmartGraph::Node, int,
     38    SmartGraph::NodeMap<int> > > dijkstra_test2(G, cap);
     39  dijkstra_test2.run(s);
    3940  post_time=currTime();
    4041 
     
    4546  int hiba_fib=0;
    4647  int hiba_bin=0;
    47   EachNodeIt u;
    48   for ( G.getFirst(u) ; G.valid(u); G.next(u) ) {
     48  NodeIt u;
     49  for ( G.first(u) ; G.valid(u); G.next(u) ) {
    4950    InEdgeIt e;
    50     for ( G.getFirst(e,u); G.valid(e); G.next(e) ) {
    51       NodeIt v=G.tail(e);
     51    for ( G.first(e,u); G.valid(e); G.next(e) ) {
     52      Node v=G.tail(e);
    5253      if ( dijkstra_test.dist(u) - dijkstra_test.dist(v) > cap.get(e) )
    5354        {
     
    8889  std::cout << "Hibas elek szama a fibonaccis Dijkstraban: "
    8990            << hiba_fib << " a " << G.edgeNum() <<"-bol."<< std::endl;
    90 
     91 
    9192  std::cout << "Hibas elek szama a binarisos Dijkstraban: "
    9293            << hiba_bin << " a " << G.edgeNum() <<"-bol."<< std::endl;
    93 
     94 
    9495
    9596
Note: See TracChangeset for help on using the changeset viewer.