COIN-OR::LEMON - Graph Library

Changeset 278:931190050520 in lemon for test/dfs_test.cc


Ignore:
Timestamp:
09/22/08 15:33:23 (16 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Improve the function-type interface of bfs, dfs, and dijkstra (ticket #96)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/dfs_test.cc

    r228 r278  
    2121#include <lemon/list_graph.h>
    2222#include <lemon/lgf_reader.h>
    23 
    2423#include <lemon/dfs.h>
    2524#include <lemon/path.h>
     
    8988
    9089  Digraph g;
    91   dfs(g,Node()).run();
    92   dfs(g).source(Node()).run();
     90  bool b;
     91  dfs(g).run(Node());
     92  b=dfs(g).run(Node(),Node());
     93  dfs(g).run();
    9394  dfs(g)
    94     .predMap(concepts::WriteMap<Node,Arc>())
    95     .distMap(concepts::WriteMap<Node,VType>())
     95    .predMap(concepts::ReadWriteMap<Node,Arc>())
     96    .distMap(concepts::ReadWriteMap<Node,VType>())
    9697    .reachedMap(concepts::ReadWriteMap<Node,bool>())
    9798    .processedMap(concepts::WriteMap<Node,bool>())
    9899    .run(Node());
     100  b=dfs(g)
     101    .predMap(concepts::ReadWriteMap<Node,Arc>())
     102    .distMap(concepts::ReadWriteMap<Node,VType>())
     103    .reachedMap(concepts::ReadWriteMap<Node,bool>())
     104    .processedMap(concepts::WriteMap<Node,bool>())
     105    .path(concepts::Path<Digraph>())
     106    .dist(VType())
     107    .run(Node(),Node());
     108  dfs(g)
     109    .predMap(concepts::ReadWriteMap<Node,Arc>())
     110    .distMap(concepts::ReadWriteMap<Node,VType>())
     111    .reachedMap(concepts::ReadWriteMap<Node,bool>())
     112    .processedMap(concepts::WriteMap<Node,bool>())
     113    .run();
    99114}
    100115
     
    130145        check(dfs_test.dist(v) - dfs_test.dist(u) == 1,
    131146              "Wrong distance. (" << dfs_test.dist(u) << "->"
    132               <<dfs_test.dist(v) << ')');
     147              << dfs_test.dist(v) << ")");
    133148      }
    134149    }
     150  }
     151
     152  {
     153    NullMap<Node,Arc> myPredMap;
     154    dfs(G).predMap(myPredMap).run(s);
    135155  }
    136156}
Note: See TracChangeset for help on using the changeset viewer.