src/work/marci/top_sort_test.cc
changeset 1365 c280de819a73
parent 1364 ee5959aa4410
child 1366 d00b85f8be45
     1.1 --- a/src/work/marci/top_sort_test.cc	Sun Apr 17 18:57:22 2005 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,58 +0,0 @@
     1.4 -// -*- c++ -*-
     1.5 -#include <iostream>
     1.6 -#include <fstream>
     1.7 -#include <list>
     1.8 -
     1.9 -#include <lemon/dimacs.h>
    1.10 -#include <bfs_dfs_misc.h>
    1.11 -#include <sage_graph.h>
    1.12 -#include <lemon/graph_wrapper.h>
    1.13 -#include <lemon/maps.h>
    1.14 -#include <for_each_macros.h>
    1.15 -
    1.16 -using namespace lemon;
    1.17 -
    1.18 -using std::cout;
    1.19 -using std::endl;
    1.20 -
    1.21 -int main() {
    1.22 -  typedef SageGraph Graph;
    1.23 -  Graph g;
    1.24 -  readDimacs(std::cin, g); 
    1.25 - 
    1.26 -  {
    1.27 -    std::list<Graph::Node> l;
    1.28 -    //NullMap<Graph::Node, Graph::Edge> pred;
    1.29 -    Graph::NodeMap<Graph::Edge> pred(g, INVALID);
    1.30 -    topSort(g, l, pred);
    1.31 -    cout << "Leaving order of dfs which is pretopological..." << endl;
    1.32 -    for(std::list<Graph::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) {
    1.33 -      cout << *i << " ";
    1.34 -    }
    1.35 -    cout << endl;
    1.36 -    
    1.37 -    FOR_EACH_LOC(Graph::NodeIt, n, g) {
    1.38 -      cout << "pred of node " << n << " is " << pred[n] << endl;
    1.39 -    }
    1.40 -  }
    1.41 -  
    1.42 -  {
    1.43 -    typedef RevGraphWrapper<Graph> GW;
    1.44 -    GW gw(g);
    1.45 -    std::list<GW::Node> l;
    1.46 -    //NullMap<GW::Node, GW::Edge> pred;
    1.47 -    GW::NodeMap<Graph::Edge> pred(gw, INVALID);
    1.48 -    topSort(gw, l, pred);
    1.49 -    cout << "Same in the reversed oriented graph..." << endl;
    1.50 -    for(std::list<GW::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) {
    1.51 -      cout << *i << " ";
    1.52 -    }
    1.53 -    cout << endl;
    1.54 -
    1.55 -    FOR_EACH_LOC(GW::NodeIt, n, gw) {
    1.56 -      cout << "pred of node " << n << " is " << pred[n] << endl;
    1.57 -    }
    1.58 -  }
    1.59 -
    1.60 -  return 0;
    1.61 -}