COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/work/marci/top_sort_test.cc @ 593:b83b36ee7f10

Last change on this file since 593:b83b36ee7f10 was 577:e8703f0a6e2f, checked in by marci, 20 years ago

top-sort, dimacs mods.

File size: 1016 bytes
RevLine 
[549]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>
[557]9#include <hugo/graph_wrapper.h>
[577]10#include <hugo/maps.h>
[549]11
12using namespace hugo;
13
14int main() {
15  typedef ListGraph Graph;
16  Graph g;
[552]17  readDimacs(std::cin, g);
18  {
19    std::list<Graph::Node> l;
[577]20    NullMap<Graph::Node, Graph::Edge> pred;
21    topSort(g, l, pred);
[552]22    std::cout << "Leaving order of dfs which is pretopological..." << std::endl;
23    for(std::list<Graph::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) {
24      std::cout << *i << " ";
25    }
26    std::cout << std::endl;
[549]27  }
[552]28 
29  {
30    typedef RevGraphWrapper<Graph> GW;
31    GW gw(g);
32    std::list<GW::Node> l;
[577]33    NullMap<GW::Node, GW::Edge> pred;
34    topSort(gw, l, pred);
[552]35    std::cout << "Same in the revered oriented graph..." << std::endl;
36    for(std::list<GW::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) {
37      std::cout << *i << " ";
38    }
39    std::cout << std::endl;
40  }
[549]41
42  return 0;
43}
Note: See TracBrowser for help on using the repository browser.