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