gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Merge bugfix #392 to branch 1.1
0 2 0
merge 1.1
2 files changed with 14 insertions and 3 deletions:
↑ Collapse diff ↑
Ignore white space 12 line context
... ...
@@ -554,13 +554,13 @@
554 554
    ///- the distance of \c t from the root in the %DFS tree.
555 555
    ///
556 556
    ///\pre init() must be called and a root node should be
557 557
    ///added with addSource() before using this function.
558 558
    void start(Node t)
559 559
    {
560
      while ( !emptyQueue() && G->target(_stack[_stack_head])!=t )
560
      while ( !emptyQueue() && !(*_reached)[t] )
561 561
        processNextArc();
562 562
    }
563 563

	
564 564
    ///Executes the algorithm until a condition is met.
565 565

	
566 566
    ///Executes the algorithm until a condition is met.
... ...
@@ -1506,13 +1506,13 @@
1506 1506
    /// - the %DFS path to \c t,
1507 1507
    /// - the distance of \c t from the root in the %DFS tree.
1508 1508
    ///
1509 1509
    /// \pre init() must be called and a root node should be added
1510 1510
    /// with addSource() before using this function.
1511 1511
    void start(Node t) {
1512
      while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != t )
1512
      while ( !emptyQueue() && !(*_reached)[t] )
1513 1513
        processNextArc();
1514 1514
    }
1515 1515

	
1516 1516
    /// \brief Executes the algorithm until a condition is met.
1517 1517
    ///
1518 1518
    /// Executes the algorithm until a condition is met.
Ignore white space 12 line context
... ...
@@ -47,13 +47,16 @@
47 47
  "4 2  4\n"
48 48
  "4 5  5\n"
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;
58 61
  typedef Dfs<Digraph> DType;
59 62
  typedef Digraph::Node Node;
... ...
@@ -176,17 +179,20 @@
176 179
template <class Digraph>
177 180
void checkDfs() {
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);
191 197

	
192 198
  Path<Digraph> p = dfs_test.path(t);
... ...
@@ -207,12 +213,17 @@
207 213
              << dfs_test.dist(v) << ")");
208 214
      }
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
}
217 228

	
218 229
int main()
0 comments (0 inline)