COIN-OR::LEMON - Graph Library

Changeset 209:765619b7cbb2 in lemon-1.0 for test/bfs_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/bfs_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 checkBfsCompile() 
     30void checkBfsCompile()
    3131{
    3232  typedef concepts::Digraph Digraph;
    3333  typedef Bfs<Digraph> BType;
    34  
     34
    3535  Digraph G;
    3636  Digraph::Node n;
     
    4141  BType::PredMap p(G);
    4242  //  BType::PredNodeMap pn(G);
    43  
     43
    4444  BType bfs_test(G);
    45  
     45
    4646  bfs_test.run(n);
    47  
     47
    4848  l  = bfs_test.dist(n);
    4949  e  = bfs_test.predArc(n);
     
    5757}
    5858
    59 void checkBfsFunctionCompile() 
     59void checkBfsFunctionCompile()
    6060{
    6161  typedef int VType;
     
    6363  typedef Digraph::Arc Arc;
    6464  typedef Digraph::Node Node;
    65    
     65
    6666  Digraph g;
    6767  bfs(g,Node()).run();
     
    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  Bfs<Digraph> bfs_test(G);
    8989  bfs_test.run(s);
    90  
     90
    9191  check(bfs_test.dist(t)==3,"Bfs found a wrong path." << bfs_test.dist(t));
    9292
     
    9696  check(pathSource(G, p) == s,"path() found a wrong path.");
    9797  check(pathTarget(G, p) == t,"path() found a wrong path.");
    98  
     98
    9999
    100100  for(ArcIt e(G); e==INVALID; ++e) {
     
    102102    Node v=G.target(e);
    103103    check( !bfs_test.reached(u) ||
    104            (bfs_test.dist(v) > bfs_test.dist(u)+1),
    105            "Wrong output.");
     104           (bfs_test.dist(v) > bfs_test.dist(u)+1),
     105           "Wrong output.");
    106106  }
    107107
     
    113113      check(u==bfs_test.predNode(v),"Wrong tree.");
    114114      check(bfs_test.dist(v) - bfs_test.dist(u) == 1,
    115             "Wrong distance. Difference: "
    116             << std::abs(bfs_test.dist(v) - bfs_test.dist(u)
    117                         - 1));
     115            "Wrong distance. Difference: "
     116            << std::abs(bfs_test.dist(v) - bfs_test.dist(u)
     117                        - 1));
    118118    }
    119119  }
Note: See TracChangeset for help on using the changeset viewer.