... | ... |
@@ -564,9 +564,9 @@ |
564 | 564 |
///\pre init() must be called and a root node should be |
565 | 565 |
///added with addSource() before using this function. |
566 | 566 |
void start(Node t) |
567 | 567 |
{ |
568 |
while ( !emptyQueue() && |
|
568 |
while ( !emptyQueue() && !(*_reached)[t] ) |
|
569 | 569 |
processNextArc(); |
570 | 570 |
} |
571 | 571 |
|
572 | 572 |
///Executes the algorithm until a condition is met. |
... | ... |
@@ -1511,9 +1511,9 @@ |
1511 | 1511 |
/// |
1512 | 1512 |
/// \pre init() must be called and a root node should be added |
1513 | 1513 |
/// with addSource() before using this function. |
1514 | 1514 |
void start(Node t) { |
1515 |
while ( !emptyQueue() && |
|
1515 |
while ( !emptyQueue() && !(*_reached)[t] ) |
|
1516 | 1516 |
processNextArc(); |
1517 | 1517 |
} |
1518 | 1518 |
|
1519 | 1519 |
/// \brief Executes the algorithm until a condition is met. |
... | ... |
@@ -49,9 +49,12 @@ |
49 | 49 |
"5 0 6\n" |
50 | 50 |
"6 3 7\n" |
51 | 51 |
"@attributes\n" |
52 | 52 |
"source 0\n" |
53 |
"target 5\n" |
|
53 |
"target 5\n" |
|
54 |
"source1 6\n" |
|
55 |
"target1 3\n"; |
|
56 |
|
|
54 | 57 |
|
55 | 58 |
void checkDfsCompile() |
56 | 59 |
{ |
57 | 60 |
typedef concepts::Digraph Digraph; |
... | ... |
@@ -178,13 +181,16 @@ |
178 | 181 |
TEMPLATE_DIGRAPH_TYPEDEFS(Digraph); |
179 | 182 |
|
180 | 183 |
Digraph G; |
181 | 184 |
Node s, t; |
185 |
Node s1, t1; |
|
182 | 186 |
|
183 | 187 |
std::istringstream input(test_lgf); |
184 | 188 |
digraphReader(G, input). |
185 | 189 |
node("source", s). |
186 | 190 |
node("target", t). |
191 |
node("source1", s1). |
|
192 |
node("target1", t1). |
|
187 | 193 |
run(); |
188 | 194 |
|
189 | 195 |
Dfs<Digraph> dfs_test(G); |
190 | 196 |
dfs_test.run(s); |
... | ... |
@@ -209,8 +215,13 @@ |
209 | 215 |
} |
210 | 216 |
} |
211 | 217 |
|
212 | 218 |
{ |
219 |
Dfs<Digraph> dfs(G); |
|
220 |
check(dfs.run(s1,t1) && dfs.reached(t1),"Node 3 is reachable from Node 6."); |
|
221 |
} |
|
222 |
|
|
223 |
{ |
|
213 | 224 |
NullMap<Node,Arc> myPredMap; |
214 | 225 |
dfs(G).predMap(myPredMap).run(s); |
215 | 226 |
} |
216 | 227 |
} |
0 comments (0 inline)