test/dfs_test.cc
branch1.1
changeset 786 c3a7ca108705
parent 738 c85f53572941
child 797 c18ed26f016c
equal deleted inserted replaced
10:c1349bb7192e 11:9f3521a902e8
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     2  *
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library.
     3  * This file is a part of LEMON, a generic C++ optimization library.
     4  *
     4  *
     5  * Copyright (C) 2003-2009
     5  * Copyright (C) 2003-2011
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     8  *
     9  * Permission to use, modify and distribute this software is granted
     9  * Permission to use, modify and distribute this software is granted
    10  * provided that this copyright notice appears in all copies. For
    10  * provided that this copyright notice appears in all copies. For
    84     dfs_test.addSource(s);
    84     dfs_test.addSource(s);
    85     e = dfs_test.processNextArc();
    85     e = dfs_test.processNextArc();
    86     e = const_dfs_test.nextArc();
    86     e = const_dfs_test.nextArc();
    87     b = const_dfs_test.emptyQueue();
    87     b = const_dfs_test.emptyQueue();
    88     i = const_dfs_test.queueSize();
    88     i = const_dfs_test.queueSize();
    89     
    89 
    90     dfs_test.start();
    90     dfs_test.start();
    91     dfs_test.start(t);
    91     dfs_test.start(t);
    92     dfs_test.start(am);
    92     dfs_test.start(am);
    93 
    93 
    94     l  = const_dfs_test.dist(t);
    94     l  = const_dfs_test.dist(t);
   110 
   110 
   111     concepts::ReadWriteMap<Node,Arc> pred_map;
   111     concepts::ReadWriteMap<Node,Arc> pred_map;
   112     concepts::ReadWriteMap<Node,int> dist_map;
   112     concepts::ReadWriteMap<Node,int> dist_map;
   113     concepts::ReadWriteMap<Node,bool> reached_map;
   113     concepts::ReadWriteMap<Node,bool> reached_map;
   114     concepts::WriteMap<Node,bool> processed_map;
   114     concepts::WriteMap<Node,bool> processed_map;
   115     
   115 
   116     dfs_test
   116     dfs_test
   117       .predMap(pred_map)
   117       .predMap(pred_map)
   118       .distMap(dist_map)
   118       .distMap(dist_map)
   119       .reachedMap(reached_map)
   119       .reachedMap(reached_map)
   120       .processedMap(processed_map);
   120       .processedMap(processed_map);
   127     dfs_test.addSource(s);
   127     dfs_test.addSource(s);
   128     e = dfs_test.processNextArc();
   128     e = dfs_test.processNextArc();
   129     e = dfs_test.nextArc();
   129     e = dfs_test.nextArc();
   130     b = dfs_test.emptyQueue();
   130     b = dfs_test.emptyQueue();
   131     i = dfs_test.queueSize();
   131     i = dfs_test.queueSize();
   132     
   132 
   133     dfs_test.start();
   133     dfs_test.start();
   134     dfs_test.start(t);
   134     dfs_test.start(t);
   135     dfs_test.start(am);
   135     dfs_test.start(am);
   136 
   136 
   137     l  = dfs_test.dist(t);
   137     l  = dfs_test.dist(t);
   217 
   217 
   218   {
   218   {
   219   Dfs<Digraph> dfs(G);
   219   Dfs<Digraph> dfs(G);
   220   check(dfs.run(s1,t1) && dfs.reached(t1),"Node 3 is reachable from Node 6.");
   220   check(dfs.run(s1,t1) && dfs.reached(t1),"Node 3 is reachable from Node 6.");
   221   }
   221   }
   222   
   222 
   223   {
   223   {
   224     NullMap<Node,Arc> myPredMap;
   224     NullMap<Node,Arc> myPredMap;
   225     dfs(G).predMap(myPredMap).run(s);
   225     dfs(G).predMap(myPredMap).run(s);
   226   }
   226   }
   227 }
   227 }