COIN-OR::LEMON - Graph Library

Changeset 209:765619b7cbb2 in lemon for test/dfs_test.cc


Ignore:
Timestamp:
07/13/08 20:51:02 (16 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Phase:
public
Message:

Apply unify-sources.sh to the source tree

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/dfs_test.cc

    r171 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    3  * This file is a part of LEMON, a generic C++ optimization library
     3 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    55 * Copyright (C) 2003-2008
     
    2828using namespace lemon;
    2929
    30 void checkDfsCompile() 
     30void checkDfsCompile()
    3131{
    3232  typedef concepts::Digraph Digraph;
    3333  typedef Dfs<Digraph> DType;
    34  
     34
    3535  Digraph G;
    3636  Digraph::Node n;
     
    4141  DType::PredMap p(G);
    4242  //  DType::PredNodeMap pn(G);
    43  
     43
    4444  DType dfs_test(G);
    45  
     45
    4646  dfs_test.run(n);
    47  
     47
    4848  l  = dfs_test.dist(n);
    4949  e  = dfs_test.predArc(n);
     
    5757}
    5858
    59 void checkDfsFunctionCompile() 
     59void checkDfsFunctionCompile()
    6060{
    6161  typedef int VType;
     
    6363  typedef Digraph::Arc Arc;
    6464  typedef Digraph::Node Node;
    65    
     65
    6666  Digraph g;
    6767  dfs(g,Node()).run();
     
    7272    .reachedMap(concepts::ReadWriteMap<Node,bool>())
    7373    .processedMap(concepts::WriteMap<Node,bool>())
    74     .run(Node()); 
     74    .run(Node());
    7575}
    7676
     
    8282  Node s, t;
    8383  PetStruct<Digraph> ps = addPetersen(G, 5);
    84    
     84
    8585  s=ps.outer[2];
    8686  t=ps.inner[0];
    87  
     87
    8888  Dfs<Digraph> dfs_test(G);
    89   dfs_test.run(s); 
    90  
     89  dfs_test.run(s);
     90
    9191  Path<Digraph> p = dfs_test.path(t);
    9292  check(p.length() == dfs_test.dist(t),"path() found a wrong path.");
     
    9494  check(pathSource(G, p) == s,"path() found a wrong path.");
    9595  check(pathTarget(G, p) == t,"path() found a wrong path.");
    96  
     96
    9797  for(NodeIt v(G); v!=INVALID; ++v) {
    9898    check(dfs_test.reached(v),"Each node should be reached.");
     
    102102      check(u==dfs_test.predNode(v),"Wrong tree.");
    103103      check(dfs_test.dist(v) - dfs_test.dist(u) == 1,
    104             "Wrong distance. (" << dfs_test.dist(u) << "->"
    105             <<dfs_test.dist(v) << ')');
     104            "Wrong distance. (" << dfs_test.dist(u) << "->"
     105            <<dfs_test.dist(v) << ')');
    106106    }
    107107  }
Note: See TracChangeset for help on using the changeset viewer.