test/dfs_test.cc
changeset 209 765619b7cbb2
parent 171 02f4d5d9bfd7
child 228 b6732e0d38c5
     1.1 --- a/test/dfs_test.cc	Sun Jul 13 16:46:56 2008 +0100
     1.2 +++ b/test/dfs_test.cc	Sun Jul 13 19:51:02 2008 +0100
     1.3 @@ -1,6 +1,6 @@
     1.4 -/* -*- C++ -*-
     1.5 +/* -*- mode: C++; indent-tabs-mode: nil; -*-
     1.6   *
     1.7 - * This file is a part of LEMON, a generic C++ optimization library
     1.8 + * This file is a part of LEMON, a generic C++ optimization library.
     1.9   *
    1.10   * Copyright (C) 2003-2008
    1.11   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.12 @@ -27,11 +27,11 @@
    1.13  
    1.14  using namespace lemon;
    1.15  
    1.16 -void checkDfsCompile() 
    1.17 +void checkDfsCompile()
    1.18  {
    1.19    typedef concepts::Digraph Digraph;
    1.20    typedef Dfs<Digraph> DType;
    1.21 -  
    1.22 +
    1.23    Digraph G;
    1.24    Digraph::Node n;
    1.25    Digraph::Arc e;
    1.26 @@ -40,11 +40,11 @@
    1.27    DType::DistMap d(G);
    1.28    DType::PredMap p(G);
    1.29    //  DType::PredNodeMap pn(G);
    1.30 -  
    1.31 +
    1.32    DType dfs_test(G);
    1.33 -  
    1.34 +
    1.35    dfs_test.run(n);
    1.36 -  
    1.37 +
    1.38    l  = dfs_test.dist(n);
    1.39    e  = dfs_test.predArc(n);
    1.40    n  = dfs_test.predNode(n);
    1.41 @@ -56,13 +56,13 @@
    1.42    Path<Digraph> pp = dfs_test.path(n);
    1.43  }
    1.44  
    1.45 -void checkDfsFunctionCompile() 
    1.46 +void checkDfsFunctionCompile()
    1.47  {
    1.48    typedef int VType;
    1.49    typedef concepts::Digraph Digraph;
    1.50    typedef Digraph::Arc Arc;
    1.51    typedef Digraph::Node Node;
    1.52 -   
    1.53 +
    1.54    Digraph g;
    1.55    dfs(g,Node()).run();
    1.56    dfs(g).source(Node()).run();
    1.57 @@ -71,7 +71,7 @@
    1.58      .distMap(concepts::WriteMap<Node,VType>())
    1.59      .reachedMap(concepts::ReadWriteMap<Node,bool>())
    1.60      .processedMap(concepts::WriteMap<Node,bool>())
    1.61 -    .run(Node()); 
    1.62 +    .run(Node());
    1.63  }
    1.64  
    1.65  template <class Digraph>
    1.66 @@ -81,19 +81,19 @@
    1.67    Digraph G;
    1.68    Node s, t;
    1.69    PetStruct<Digraph> ps = addPetersen(G, 5);
    1.70 -   
    1.71 +
    1.72    s=ps.outer[2];
    1.73    t=ps.inner[0];
    1.74 -  
    1.75 +
    1.76    Dfs<Digraph> dfs_test(G);
    1.77 -  dfs_test.run(s);  
    1.78 -  
    1.79 +  dfs_test.run(s);
    1.80 +
    1.81    Path<Digraph> p = dfs_test.path(t);
    1.82    check(p.length() == dfs_test.dist(t),"path() found a wrong path.");
    1.83    check(checkPath(G, p),"path() found a wrong path.");
    1.84    check(pathSource(G, p) == s,"path() found a wrong path.");
    1.85    check(pathTarget(G, p) == t,"path() found a wrong path.");
    1.86 -  
    1.87 +
    1.88    for(NodeIt v(G); v!=INVALID; ++v) {
    1.89      check(dfs_test.reached(v),"Each node should be reached.");
    1.90      if ( dfs_test.predArc(v)!=INVALID ) {
    1.91 @@ -101,8 +101,8 @@
    1.92        Node u=G.source(e);
    1.93        check(u==dfs_test.predNode(v),"Wrong tree.");
    1.94        check(dfs_test.dist(v) - dfs_test.dist(u) == 1,
    1.95 -	    "Wrong distance. (" << dfs_test.dist(u) << "->" 
    1.96 -	    <<dfs_test.dist(v) << ')');
    1.97 +            "Wrong distance. (" << dfs_test.dist(u) << "->"
    1.98 +            <<dfs_test.dist(v) << ')');
    1.99      }
   1.100    }
   1.101  }