COIN-OR::LEMON - Graph Library

Ticket #51: 51-fixes-6f10c6ec5a21.patch

File 51-fixes-6f10c6ec5a21.patch, 1.6 KB (added by Peter Kovacs, 15 years ago)
  • lemon/bellman_ford.h

    # HG changeset patch
    # User Peter Kovacs <kpeter@inf.elte.hu>
    # Date 1254146000 -7200
    # Node ID 6f10c6ec5a21c7d42d3dab98ef84bc936c1142ea
    # Parent  0977046c60d27196e3b008fe9f65350180ec5362
    Small fixes related to BellmanFord (#51)
    
     - Add a missing #include.
     - Add a missing const keyword for negativeCycle().
     - Test if negativeCycle() is const function.
    
    diff --git a/lemon/bellman_ford.h b/lemon/bellman_ford.h
    a b  
    2323/// \file
    2424/// \brief Bellman-Ford algorithm.
    2525
     26#include <lemon/list_graph.h>
    2627#include <lemon/bits/path_dump.h>
    2728#include <lemon/core.h>
    2829#include <lemon/error.h>
     
    775776    /// This function gives back a directed cycle with negative total
    776777    /// length if the algorithm has already found one.
    777778    /// Otherwise it gives back an empty path.
    778     lemon::Path<Digraph> negativeCycle() {
     779    lemon::Path<Digraph> negativeCycle() const {
    779780      typename Digraph::template NodeMap<int> state(*_gr, -1);
    780781      lemon::Path<Digraph> cycle;
    781782      for (int i = 0; i < int(_process.size()); ++i) {
  • test/bellman_ford_test.cc

    diff --git a/test/bellman_ford_test.cc b/test/bellman_ford_test.cc
    a b  
    9696    d  = const_bf_test.distMap();
    9797    p  = const_bf_test.predMap();
    9898    pp = const_bf_test.path(t);
     99    pp = const_bf_test.negativeCycle();
    99100   
    100101    for (BF::ActiveIt it(const_bf_test); it != INVALID; ++it) {}
    101102  }
     
    132133    s  = bf_test.predNode(t);
    133134    b  = bf_test.reached(t);
    134135    pp = bf_test.path(t);
     136    pp = bf_test.negativeCycle();
    135137  }
    136138}
    137139