src/work/marci/top_sort_test.cc
changeset 552 83c22ca968d8
parent 549 5531429143bc
child 557 9c0ce0a1f000
     1.1 --- a/src/work/marci/top_sort_test.cc	Thu May 06 15:19:59 2004 +0000
     1.2 +++ b/src/work/marci/top_sort_test.cc	Thu May 06 15:24:42 2004 +0000
     1.3 @@ -6,20 +6,35 @@
     1.4  #include <hugo/dimacs.h>
     1.5  #include <bfs_dfs_misc.h>
     1.6  #include <list_graph.h>
     1.7 +#include <graph_wrapper.h>
     1.8  
     1.9  using namespace hugo;
    1.10  
    1.11  int main() {
    1.12    typedef ListGraph Graph;
    1.13    Graph g;
    1.14 -  readDimacs(std::cin, g);
    1.15 -  std::list<Graph::Node> l;
    1.16 -  topSort(g, l);
    1.17 -  std::cout << "Leaving order of dfs which is pretopological..." << std::endl;
    1.18 -  for(std::list<Graph::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) {
    1.19 -    std::cout << *i << " ";
    1.20 +  readDimacs(std::cin, g); 
    1.21 +  {
    1.22 +    std::list<Graph::Node> l;
    1.23 +    topSort(g, l);
    1.24 +    std::cout << "Leaving order of dfs which is pretopological..." << std::endl;
    1.25 +    for(std::list<Graph::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) {
    1.26 +      std::cout << *i << " ";
    1.27 +    }
    1.28 +    std::cout << std::endl;
    1.29    }
    1.30 -  std::cout << std::endl;
    1.31 +  
    1.32 +  {
    1.33 +    typedef RevGraphWrapper<Graph> GW;
    1.34 +    GW gw(g);
    1.35 +    std::list<GW::Node> l;
    1.36 +    topSort(gw, l);
    1.37 +    std::cout << "Same in the revered oriented graph..." << std::endl;
    1.38 +    for(std::list<GW::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) {
    1.39 +      std::cout << *i << " ";
    1.40 +    }
    1.41 +    std::cout << std::endl;
    1.42 +  }
    1.43  
    1.44    return 0;
    1.45  }