test/bellman_ford_test.cc
changeset 956 141f9c0db4a3
parent 917 a6eb9698c321
child 960 b89e46862dc2
     1.1 --- a/test/bellman_ford_test.cc	Wed Mar 17 12:35:52 2010 +0100
     1.2 +++ b/test/bellman_ford_test.cc	Sat Mar 06 14:35:12 2010 +0000
     1.3 @@ -2,7 +2,7 @@
     1.4   *
     1.5   * This file is a part of LEMON, a generic C++ optimization library.
     1.6   *
     1.7 - * Copyright (C) 2003-2009
     1.8 + * Copyright (C) 2003-2010
     1.9   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.10   * (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.11   *
    1.12 @@ -97,7 +97,7 @@
    1.13      p  = const_bf_test.predMap();
    1.14      pp = const_bf_test.path(t);
    1.15      pp = const_bf_test.negativeCycle();
    1.16 -    
    1.17 +
    1.18      for (BF::ActiveIt it(const_bf_test); it != INVALID; ++it) {}
    1.19    }
    1.20    {
    1.21 @@ -110,7 +110,7 @@
    1.22      LengthMap length_map;
    1.23      concepts::ReadWriteMap<Node,Arc> pred_map;
    1.24      concepts::ReadWriteMap<Node,Value> dist_map;
    1.25 -    
    1.26 +
    1.27      bf_test
    1.28        .lengthMap(length_map)
    1.29        .predMap(pred_map)
    1.30 @@ -189,7 +189,7 @@
    1.31    check(checkPath(gr, p), "path() found a wrong path.");
    1.32    check(pathSource(gr, p) == s, "path() found a wrong path.");
    1.33    check(pathTarget(gr, p) == t, "path() found a wrong path.");
    1.34 -  
    1.35 +
    1.36    ListPath<Digraph> path;
    1.37    Value dist;
    1.38    bool reached = bellmanFord(gr,length).path(path).dist(dist).run(s,t);
    1.39 @@ -228,18 +228,18 @@
    1.40  
    1.41    SmartDigraph gr;
    1.42    IntArcMap length(gr);
    1.43 -  
    1.44 +
    1.45    Node n1 = gr.addNode();
    1.46    Node n2 = gr.addNode();
    1.47    Node n3 = gr.addNode();
    1.48    Node n4 = gr.addNode();
    1.49 -  
    1.50 +
    1.51    Arc a1 = gr.addArc(n1, n2);
    1.52    Arc a2 = gr.addArc(n2, n2);
    1.53 -  
    1.54 +
    1.55    length[a1] = 2;
    1.56    length[a2] = -1;
    1.57 -  
    1.58 +
    1.59    {
    1.60      BellmanFord<SmartDigraph, IntArcMap> bf(gr, length);
    1.61      bf.run(n1);
    1.62 @@ -247,21 +247,21 @@
    1.63      check(p.length() == 1 && p.front() == p.back() && p.front() == a2,
    1.64            "Wrong negative cycle.");
    1.65    }
    1.66 - 
    1.67 +
    1.68    length[a2] = 0;
    1.69 -  
    1.70 +
    1.71    {
    1.72      BellmanFord<SmartDigraph, IntArcMap> bf(gr, length);
    1.73      bf.run(n1);
    1.74      check(bf.negativeCycle().empty(),
    1.75            "Negative cycle should not be found.");
    1.76    }
    1.77 -  
    1.78 +
    1.79    length[gr.addArc(n1, n3)] = 5;
    1.80    length[gr.addArc(n4, n3)] = 1;
    1.81    length[gr.addArc(n2, n4)] = 2;
    1.82    length[gr.addArc(n3, n2)] = -4;
    1.83 -  
    1.84 +
    1.85    {
    1.86      BellmanFord<SmartDigraph, IntArcMap> bf(gr, length);
    1.87      bf.init();