COIN-OR::LEMON - Graph Library

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


Ignore:
Timestamp:
07/13/08 20:51:02 (11 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/dijkstra_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
     
    2929using namespace lemon;
    3030
    31 void checkDijkstraCompile() 
     31void checkDijkstraCompile()
    3232{
    3333  typedef int VType;
     
    3535  typedef concepts::ReadMap<Digraph::Arc,VType> LengthMap;
    3636  typedef Dijkstra<Digraph, LengthMap> DType;
    37  
     37
    3838  Digraph G;
    3939  Digraph::Node n;
     
    6161}
    6262
    63 void checkDijkstraFunctionCompile() 
     63void checkDijkstraFunctionCompile()
    6464{
    6565  typedef int VType;
     
    6868  typedef Digraph::Node Node;
    6969  typedef concepts::ReadMap<Digraph::Arc,VType> LengthMap;
    70    
     70
    7171  Digraph g;
    7272  dijkstra(g,LengthMap(),Node()).run();
     
    7979
    8080template <class Digraph>
    81 void checkDijkstra() {   
     81void checkDijkstra() {
    8282  TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
    8383  typedef typename Digraph::template ArcMap<int> LengthMap;
     
    8787  LengthMap length(G);
    8888  PetStruct<Digraph> ps = addPetersen(G, 5);
    89    
     89
    9090  for(int i=0;i<5;i++) {
    9191    length[ps.outcir[i]]=4;
     
    9595  s=ps.outer[0];
    9696  t=ps.inner[1];
    97  
    98   Dijkstra<Digraph, LengthMap> 
    99         dijkstra_test(G, length);
     97
     98  Dijkstra<Digraph, LengthMap>
     99        dijkstra_test(G, length);
    100100  dijkstra_test.run(s);
    101  
     101
    102102  check(dijkstra_test.dist(t)==13,"Dijkstra found a wrong path.");
    103103
     
    107107  check(pathSource(G, p) == s,"path() found a wrong path.");
    108108  check(pathTarget(G, p) == t,"path() found a wrong path.");
    109  
     109
    110110  for(ArcIt e(G); e!=INVALID; ++e) {
    111111    Node u=G.source(e);
    112112    Node v=G.target(e);
    113113    check( !dijkstra_test.reached(u) || (dijkstra_test.dist(v) - dijkstra_test.dist(u) <= length[e]),
    114            "dist(target)-dist(source)-arc_length= " << dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]);
     114           "dist(target)-dist(source)-arc_length= " << dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]);
    115115  }
    116116
     
    122122      check(u==dijkstra_test.predNode(v),"Wrong tree.");
    123123      check(dijkstra_test.dist(v) - dijkstra_test.dist(u) == length[e],
    124             "Wrong distance! Difference: " << std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]));
     124            "Wrong distance! Difference: " << std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]));
    125125    }
    126126  }
    127  
     127
    128128  {
    129129    NullMap<Node,Arc> myPredMap;
Note: See TracChangeset for help on using the changeset viewer.