COIN-OR::LEMON - Graph Library

Changeset 278:931190050520 in lemon for test/dijkstra_test.cc


Ignore:
Timestamp:
09/22/08 15:33:23 (11 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Improve the function-type interface of bfs, dfs, and dijkstra (ticket #96)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/dijkstra_test.cc

    r228 r278  
    2121#include <lemon/list_graph.h>
    2222#include <lemon/lgf_reader.h>
    23 
    2423#include <lemon/dijkstra.h>
    2524#include <lemon/path.h>
     
    6564  DType::DistMap d(G);
    6665  DType::PredMap p(G);
    67   //  DType::PredNodeMap pn(G);
    6866  LengthMap length;
    6967
     
    7775  d  = dijkstra_test.distMap();
    7876  p  = dijkstra_test.predMap();
    79   //  pn = dijkstra_test.predNodeMap();
    8077  b  = dijkstra_test.reached(n);
    8178
     
    9289
    9390  Digraph g;
    94   dijkstra(g,LengthMap(),Node()).run();
    95   dijkstra(g,LengthMap()).source(Node()).run();
     91  bool b;
     92  dijkstra(g,LengthMap()).run(Node());
     93  b=dijkstra(g,LengthMap()).run(Node(),Node());
    9694  dijkstra(g,LengthMap())
    97     .predMap(concepts::WriteMap<Node,Arc>())
    98     .distMap(concepts::WriteMap<Node,VType>())
     95    .predMap(concepts::ReadWriteMap<Node,Arc>())
     96    .distMap(concepts::ReadWriteMap<Node,VType>())
     97    .processedMap(concepts::WriteMap<Node,bool>())
    9998    .run(Node());
     99  b=dijkstra(g,LengthMap())
     100    .predMap(concepts::ReadWriteMap<Node,Arc>())
     101    .distMap(concepts::ReadWriteMap<Node,VType>())
     102    .processedMap(concepts::WriteMap<Node,bool>())
     103    .path(concepts::Path<Digraph>())
     104    .dist(VType())
     105    .run(Node(),Node());
    100106}
    101107
     
    123129
    124130  Path<Digraph> p = dijkstra_test.path(t);
    125   check(p.length()==3,"getPath() found a wrong path.");
     131  check(p.length()==3,"path() found a wrong path.");
    126132  check(checkPath(G, p),"path() found a wrong path.");
    127133  check(pathSource(G, p) == s,"path() found a wrong path.");
     
    133139    check( !dijkstra_test.reached(u) ||
    134140           (dijkstra_test.dist(v) - dijkstra_test.dist(u) <= length[e]),
    135            "dist(target)-dist(source)-arc_length= " <<
     141           "Wrong output. dist(target)-dist(source)-arc_length=" <<
    136142           dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]);
    137143  }
Note: See TracChangeset for help on using the changeset viewer.