test/bfs_test.cc
changeset 804 4db8d5ccd26b
parent 440 88ed40ad0d4f
child 877 141f9c0db4a3
child 969 7e368d9b67f7
equal deleted inserted replaced
8:89041efc5944 9:c08860b44b6f
    56   typedef Bfs<Digraph> BType;
    56   typedef Bfs<Digraph> BType;
    57   typedef Digraph::Node Node;
    57   typedef Digraph::Node Node;
    58   typedef Digraph::Arc Arc;
    58   typedef Digraph::Arc Arc;
    59 
    59 
    60   Digraph G;
    60   Digraph G;
    61   Node s, t;
    61   Node s, t, n;
    62   Arc e;
    62   Arc e;
    63   int l;
    63   int l, i;
    64   bool b;
    64   bool b;
    65   BType::DistMap d(G);
    65   BType::DistMap d(G);
    66   BType::PredMap p(G);
    66   BType::PredMap p(G);
    67   Path<Digraph> pp;
    67   Path<Digraph> pp;
       
    68   concepts::ReadMap<Node,bool> nm;
    68 
    69 
    69   {
    70   {
    70     BType bfs_test(G);
    71     BType bfs_test(G);
       
    72     const BType& const_bfs_test = bfs_test;
    71 
    73 
    72     bfs_test.run(s);
    74     bfs_test.run(s);
    73     bfs_test.run(s,t);
    75     bfs_test.run(s,t);
    74     bfs_test.run();
    76     bfs_test.run();
    75 
    77 
    76     l  = bfs_test.dist(t);
    78     bfs_test.init();
    77     e  = bfs_test.predArc(t);
    79     bfs_test.addSource(s);
    78     s  = bfs_test.predNode(t);
    80     n = bfs_test.processNextNode();
    79     b  = bfs_test.reached(t);
    81     n = bfs_test.processNextNode(t, b);
    80     d  = bfs_test.distMap();
    82     n = bfs_test.processNextNode(nm, n);
    81     p  = bfs_test.predMap();
    83     n = const_bfs_test.nextNode();
    82     pp = bfs_test.path(t);
    84     b = const_bfs_test.emptyQueue();
       
    85     i = const_bfs_test.queueSize();
       
    86     
       
    87     bfs_test.start();
       
    88     bfs_test.start(t);
       
    89     bfs_test.start(nm);
       
    90 
       
    91     l  = const_bfs_test.dist(t);
       
    92     e  = const_bfs_test.predArc(t);
       
    93     s  = const_bfs_test.predNode(t);
       
    94     b  = const_bfs_test.reached(t);
       
    95     d  = const_bfs_test.distMap();
       
    96     p  = const_bfs_test.predMap();
       
    97     pp = const_bfs_test.path(t);
    83   }
    98   }
    84   {
    99   {
    85     BType
   100     BType
    86       ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
   101       ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
    87       ::SetDistMap<concepts::ReadWriteMap<Node,int> >
   102       ::SetDistMap<concepts::ReadWriteMap<Node,int> >
    88       ::SetReachedMap<concepts::ReadWriteMap<Node,bool> >
   103       ::SetReachedMap<concepts::ReadWriteMap<Node,bool> >
       
   104       ::SetStandardProcessedMap
    89       ::SetProcessedMap<concepts::WriteMap<Node,bool> >
   105       ::SetProcessedMap<concepts::WriteMap<Node,bool> >
    90       ::SetStandardProcessedMap
       
    91       ::Create bfs_test(G);
   106       ::Create bfs_test(G);
       
   107       
       
   108     concepts::ReadWriteMap<Node,Arc> pred_map;
       
   109     concepts::ReadWriteMap<Node,int> dist_map;
       
   110     concepts::ReadWriteMap<Node,bool> reached_map;
       
   111     concepts::WriteMap<Node,bool> processed_map;
       
   112     
       
   113     bfs_test
       
   114       .predMap(pred_map)
       
   115       .distMap(dist_map)
       
   116       .reachedMap(reached_map)
       
   117       .processedMap(processed_map);
    92 
   118 
    93     bfs_test.run(s);
   119     bfs_test.run(s);
    94     bfs_test.run(s,t);
   120     bfs_test.run(s,t);
    95     bfs_test.run();
   121     bfs_test.run();
       
   122     
       
   123     bfs_test.init();
       
   124     bfs_test.addSource(s);
       
   125     n = bfs_test.processNextNode();
       
   126     n = bfs_test.processNextNode(t, b);
       
   127     n = bfs_test.processNextNode(nm, n);
       
   128     n = bfs_test.nextNode();
       
   129     b = bfs_test.emptyQueue();
       
   130     i = bfs_test.queueSize();
       
   131     
       
   132     bfs_test.start();
       
   133     bfs_test.start(t);
       
   134     bfs_test.start(nm);
    96 
   135 
    97     l  = bfs_test.dist(t);
   136     l  = bfs_test.dist(t);
    98     e  = bfs_test.predArc(t);
   137     e  = bfs_test.predArc(t);
    99     s  = bfs_test.predNode(t);
   138     s  = bfs_test.predNode(t);
   100     b  = bfs_test.reached(t);
   139     b  = bfs_test.reached(t);