| ... | ... |
@@ -20,97 +20,97 @@ |
| 20 | 20 |
#include <lemon/smart_graph.h> |
| 21 | 21 |
#include <lemon/list_graph.h> |
| 22 | 22 |
#include <lemon/lgf_reader.h> |
| 23 | 23 |
#include <lemon/bellman_ford.h> |
| 24 | 24 |
#include <lemon/path.h> |
| 25 | 25 |
|
| 26 | 26 |
#include "graph_test.h" |
| 27 | 27 |
#include "test_tools.h" |
| 28 | 28 |
|
| 29 | 29 |
using namespace lemon; |
| 30 | 30 |
|
| 31 | 31 |
char test_lgf[] = |
| 32 | 32 |
"@nodes\n" |
| 33 | 33 |
"label\n" |
| 34 | 34 |
"0\n" |
| 35 | 35 |
"1\n" |
| 36 | 36 |
"2\n" |
| 37 | 37 |
"3\n" |
| 38 | 38 |
"4\n" |
| 39 | 39 |
"@arcs\n" |
| 40 | 40 |
" length\n" |
| 41 | 41 |
"0 1 3\n" |
| 42 | 42 |
"1 2 -3\n" |
| 43 | 43 |
"1 2 -5\n" |
| 44 | 44 |
"1 3 -2\n" |
| 45 | 45 |
"0 2 -1\n" |
| 46 | 46 |
"1 2 -4\n" |
| 47 | 47 |
"0 3 2\n" |
| 48 | 48 |
"4 2 -5\n" |
| 49 | 49 |
"2 3 1\n" |
| 50 | 50 |
"@attributes\n" |
| 51 | 51 |
"source 0\n" |
| 52 | 52 |
"target 3\n"; |
| 53 | 53 |
|
| 54 | 54 |
|
| 55 | 55 |
void checkBellmanFordCompile() |
| 56 | 56 |
{
|
| 57 | 57 |
typedef int Value; |
| 58 | 58 |
typedef concepts::Digraph Digraph; |
| 59 | 59 |
typedef concepts::ReadMap<Digraph::Arc,Value> LengthMap; |
| 60 | 60 |
typedef BellmanFord<Digraph, LengthMap> BF; |
| 61 | 61 |
typedef Digraph::Node Node; |
| 62 | 62 |
typedef Digraph::Arc Arc; |
| 63 | 63 |
|
| 64 | 64 |
Digraph gr; |
| 65 | 65 |
Node s, t, n; |
| 66 | 66 |
Arc e; |
| 67 | 67 |
Value l; |
| 68 |
int k; |
|
| 68 |
int k=3; |
|
| 69 | 69 |
bool b; |
| 70 | 70 |
BF::DistMap d(gr); |
| 71 | 71 |
BF::PredMap p(gr); |
| 72 | 72 |
LengthMap length; |
| 73 | 73 |
concepts::Path<Digraph> pp; |
| 74 | 74 |
|
| 75 | 75 |
{
|
| 76 | 76 |
BF bf_test(gr,length); |
| 77 | 77 |
const BF& const_bf_test = bf_test; |
| 78 | 78 |
|
| 79 | 79 |
bf_test.run(s); |
| 80 | 80 |
bf_test.run(s,k); |
| 81 | 81 |
|
| 82 | 82 |
bf_test.init(); |
| 83 | 83 |
bf_test.addSource(s); |
| 84 | 84 |
bf_test.addSource(s, 1); |
| 85 | 85 |
b = bf_test.processNextRound(); |
| 86 | 86 |
b = bf_test.processNextWeakRound(); |
| 87 | 87 |
|
| 88 | 88 |
bf_test.start(); |
| 89 | 89 |
bf_test.checkedStart(); |
| 90 | 90 |
bf_test.limitedStart(k); |
| 91 | 91 |
|
| 92 | 92 |
l = const_bf_test.dist(t); |
| 93 | 93 |
e = const_bf_test.predArc(t); |
| 94 | 94 |
s = const_bf_test.predNode(t); |
| 95 | 95 |
b = const_bf_test.reached(t); |
| 96 | 96 |
d = const_bf_test.distMap(); |
| 97 | 97 |
p = const_bf_test.predMap(); |
| 98 | 98 |
pp = const_bf_test.path(t); |
| 99 | 99 |
|
| 100 | 100 |
for (BF::ActiveIt it(const_bf_test); it != INVALID; ++it) {}
|
| 101 | 101 |
} |
| 102 | 102 |
{
|
| 103 | 103 |
BF::SetPredMap<concepts::ReadWriteMap<Node,Arc> > |
| 104 | 104 |
::SetDistMap<concepts::ReadWriteMap<Node,Value> > |
| 105 | 105 |
::SetOperationTraits<BellmanFordDefaultOperationTraits<Value> > |
| 106 | 106 |
::Create bf_test(gr,length); |
| 107 | 107 |
|
| 108 | 108 |
LengthMap length_map; |
| 109 | 109 |
concepts::ReadWriteMap<Node,Arc> pred_map; |
| 110 | 110 |
concepts::ReadWriteMap<Node,Value> dist_map; |
| 111 | 111 |
|
| 112 | 112 |
bf_test |
| 113 | 113 |
.lengthMap(length_map) |
| 114 | 114 |
.predMap(pred_map) |
| 115 | 115 |
.distMap(dist_map); |
| 116 | 116 |
|
0 comments (0 inline)