COIN-OR::LEMON - Graph Library

Changeset 286:da414906fe21 in lemon for test/bfs_test.cc


Ignore:
Timestamp:
09/26/08 12:40:11 (11 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Improvements related to BFS/DFS/Dijkstra (ticket #96)

  • Add run(s,t) function to BfsVisit?.
  • Modify run(s,t) functions in the class interfaces to return bool value.
  • Bug fix in Dijkstra::start(t) function.
  • Improve Dijkstra::currentDist().
  • Extend test files to check named class template parameters.
  • Doc improvements.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/bfs_test.cc

    r278 r286  
    5555  typedef concepts::Digraph Digraph;
    5656  typedef Bfs<Digraph> BType;
     57  typedef Digraph::Node Node;
     58  typedef Digraph::Arc Arc;
    5759
    5860  Digraph G;
    59   Digraph::Node n;
    60   Digraph::Arc e;
     61  Node s, t;
     62  Arc e;
    6163  int l;
    6264  bool b;
    6365  BType::DistMap d(G);
    6466  BType::PredMap p(G);
     67  Path<Digraph> pp;
    6568
    66   BType bfs_test(G);
     69  {
     70    BType bfs_test(G);
    6771
    68   bfs_test.run(n);
     72    bfs_test.run(s);
     73    bfs_test.run(s,t);
     74    bfs_test.run();
    6975
    70   l  = bfs_test.dist(n);
    71   e  = bfs_test.predArc(n);
    72   n  = bfs_test.predNode(n);
    73   d  = bfs_test.distMap();
    74   p  = bfs_test.predMap();
    75   b  = bfs_test.reached(n);
     76    l  = bfs_test.dist(t);
     77    e  = bfs_test.predArc(t);
     78    s  = bfs_test.predNode(t);
     79    b  = bfs_test.reached(t);
     80    d  = bfs_test.distMap();
     81    p  = bfs_test.predMap();
     82    pp = bfs_test.path(t);
     83  }
     84  {
     85    BType
     86      ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
     87      ::SetDistMap<concepts::ReadWriteMap<Node,int> >
     88      ::SetReachedMap<concepts::ReadWriteMap<Node,bool> >
     89      ::SetProcessedMap<concepts::WriteMap<Node,bool> >
     90      ::SetStandardProcessedMap
     91      ::Create bfs_test(G);
    7692
    77   Path<Digraph> pp = bfs_test.path(n);
     93    bfs_test.run(s);
     94    bfs_test.run(s,t);
     95    bfs_test.run();
     96
     97    l  = bfs_test.dist(t);
     98    e  = bfs_test.predArc(t);
     99    s  = bfs_test.predNode(t);
     100    b  = bfs_test.reached(t);
     101    pp = bfs_test.path(t);
     102  }
    78103}
    79104
Note: See TracChangeset for help on using the changeset viewer.