test/bfs_test.cc
changeset 802 994c7df296c9
parent 440 88ed40ad0d4f
child 877 141f9c0db4a3
child 1007 7e368d9b67f7
     1.1 --- a/test/bfs_test.cc	Fri Nov 13 12:33:33 2009 +0100
     1.2 +++ b/test/bfs_test.cc	Thu Dec 10 17:05:35 2009 +0100
     1.3 @@ -2,7 +2,7 @@
     1.4   *
     1.5   * This file is a part of LEMON, a generic C++ optimization library.
     1.6   *
     1.7 - * Copyright (C) 2003-2008
     1.8 + * Copyright (C) 2003-2009
     1.9   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.10   * (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.11   *
    1.12 @@ -58,41 +58,80 @@
    1.13    typedef Digraph::Arc Arc;
    1.14  
    1.15    Digraph G;
    1.16 -  Node s, t;
    1.17 +  Node s, t, n;
    1.18    Arc e;
    1.19 -  int l;
    1.20 +  int l, i;
    1.21    bool b;
    1.22    BType::DistMap d(G);
    1.23    BType::PredMap p(G);
    1.24    Path<Digraph> pp;
    1.25 +  concepts::ReadMap<Node,bool> nm;
    1.26  
    1.27    {
    1.28      BType bfs_test(G);
    1.29 +    const BType& const_bfs_test = bfs_test;
    1.30  
    1.31      bfs_test.run(s);
    1.32      bfs_test.run(s,t);
    1.33      bfs_test.run();
    1.34  
    1.35 -    l  = bfs_test.dist(t);
    1.36 -    e  = bfs_test.predArc(t);
    1.37 -    s  = bfs_test.predNode(t);
    1.38 -    b  = bfs_test.reached(t);
    1.39 -    d  = bfs_test.distMap();
    1.40 -    p  = bfs_test.predMap();
    1.41 -    pp = bfs_test.path(t);
    1.42 +    bfs_test.init();
    1.43 +    bfs_test.addSource(s);
    1.44 +    n = bfs_test.processNextNode();
    1.45 +    n = bfs_test.processNextNode(t, b);
    1.46 +    n = bfs_test.processNextNode(nm, n);
    1.47 +    n = const_bfs_test.nextNode();
    1.48 +    b = const_bfs_test.emptyQueue();
    1.49 +    i = const_bfs_test.queueSize();
    1.50 +    
    1.51 +    bfs_test.start();
    1.52 +    bfs_test.start(t);
    1.53 +    bfs_test.start(nm);
    1.54 +
    1.55 +    l  = const_bfs_test.dist(t);
    1.56 +    e  = const_bfs_test.predArc(t);
    1.57 +    s  = const_bfs_test.predNode(t);
    1.58 +    b  = const_bfs_test.reached(t);
    1.59 +    d  = const_bfs_test.distMap();
    1.60 +    p  = const_bfs_test.predMap();
    1.61 +    pp = const_bfs_test.path(t);
    1.62    }
    1.63    {
    1.64      BType
    1.65        ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
    1.66        ::SetDistMap<concepts::ReadWriteMap<Node,int> >
    1.67        ::SetReachedMap<concepts::ReadWriteMap<Node,bool> >
    1.68 +      ::SetStandardProcessedMap
    1.69        ::SetProcessedMap<concepts::WriteMap<Node,bool> >
    1.70 -      ::SetStandardProcessedMap
    1.71        ::Create bfs_test(G);
    1.72 +      
    1.73 +    concepts::ReadWriteMap<Node,Arc> pred_map;
    1.74 +    concepts::ReadWriteMap<Node,int> dist_map;
    1.75 +    concepts::ReadWriteMap<Node,bool> reached_map;
    1.76 +    concepts::WriteMap<Node,bool> processed_map;
    1.77 +    
    1.78 +    bfs_test
    1.79 +      .predMap(pred_map)
    1.80 +      .distMap(dist_map)
    1.81 +      .reachedMap(reached_map)
    1.82 +      .processedMap(processed_map);
    1.83  
    1.84      bfs_test.run(s);
    1.85      bfs_test.run(s,t);
    1.86      bfs_test.run();
    1.87 +    
    1.88 +    bfs_test.init();
    1.89 +    bfs_test.addSource(s);
    1.90 +    n = bfs_test.processNextNode();
    1.91 +    n = bfs_test.processNextNode(t, b);
    1.92 +    n = bfs_test.processNextNode(nm, n);
    1.93 +    n = bfs_test.nextNode();
    1.94 +    b = bfs_test.emptyQueue();
    1.95 +    i = bfs_test.queueSize();
    1.96 +    
    1.97 +    bfs_test.start();
    1.98 +    bfs_test.start(t);
    1.99 +    bfs_test.start(nm);
   1.100  
   1.101      l  = bfs_test.dist(t);
   1.102      e  = bfs_test.predArc(t);