COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
05/11/04 17:54:00 (20 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@791
Message:

misc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/marci/top_sort_test.cc

    r577 r609  
    99#include <hugo/graph_wrapper.h>
    1010#include <hugo/maps.h>
     11#include <for_each_macros.h>
    1112
    1213using namespace hugo;
     14
     15using std::cout;
     16using std::endl;
    1317
    1418int main() {
     
    1620  Graph g;
    1721  readDimacs(std::cin, g);
     22 
    1823  {
    1924    std::list<Graph::Node> l;
    20     NullMap<Graph::Node, Graph::Edge> pred;
     25    //NullMap<Graph::Node, Graph::Edge> pred;
     26    Graph::NodeMap<Graph::Edge> pred(g, INVALID);
    2127    topSort(g, l, pred);
    22     std::cout << "Leaving order of dfs which is pretopological..." << std::endl;
     28    cout << "Leaving order of dfs which is pretopological..." << endl;
    2329    for(std::list<Graph::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) {
    24       std::cout << *i << " ";
     30      cout << *i << " ";
    2531    }
    26     std::cout << std::endl;
     32    cout << endl;
     33   
     34    FOR_EACH_LOC(Graph::NodeIt, n, g) {
     35      cout << "pred of node " << n << " is " << pred[n] << endl;
     36    }
    2737  }
    2838 
     
    3141    GW gw(g);
    3242    std::list<GW::Node> l;
    33     NullMap<GW::Node, GW::Edge> pred;
     43    //NullMap<GW::Node, GW::Edge> pred;
     44    GW::NodeMap<Graph::Edge> pred(gw, INVALID);
    3445    topSort(gw, l, pred);
    35     std::cout << "Same in the revered oriented graph..." << std::endl;
     46    cout << "Same in the reversed oriented graph..." << endl;
    3647    for(std::list<GW::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) {
    37       std::cout << *i << " ";
     48      cout << *i << " ";
    3849    }
    39     std::cout << std::endl;
     50    cout << endl;
     51
     52    FOR_EACH_LOC(GW::NodeIt, n, gw) {
     53      cout << "pred of node " << n << " is " << pred[n] << endl;
     54    }
    4055  }
    4156
Note: See TracChangeset for help on using the changeset viewer.