src/work/marci/top_sort_test.cc
author marci
Fri, 07 May 2004 10:57:31 +0000
changeset 576 d00c33d07114
parent 552 83c22ca968d8
child 577 e8703f0a6e2f
permissions -rw-r--r--
(none)
     1 // -*- c++ -*-
     2 #include <iostream>
     3 #include <fstream>
     4 #include <list>
     5 
     6 #include <hugo/dimacs.h>
     7 #include <bfs_dfs_misc.h>
     8 #include <list_graph.h>
     9 #include <hugo/graph_wrapper.h>
    10 
    11 using namespace hugo;
    12 
    13 int main() {
    14   typedef ListGraph Graph;
    15   Graph g;
    16   readDimacs(std::cin, g); 
    17   {
    18     std::list<Graph::Node> l;
    19     topSort(g, l);
    20     std::cout << "Leaving order of dfs which is pretopological..." << std::endl;
    21     for(std::list<Graph::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) {
    22       std::cout << *i << " ";
    23     }
    24     std::cout << std::endl;
    25   }
    26   
    27   {
    28     typedef RevGraphWrapper<Graph> GW;
    29     GW gw(g);
    30     std::list<GW::Node> l;
    31     topSort(gw, l);
    32     std::cout << "Same in the revered oriented graph..." << std::endl;
    33     for(std::list<GW::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) {
    34       std::cout << *i << " ";
    35     }
    36     std::cout << std::endl;
    37   }
    38 
    39   return 0;
    40 }