COIN-OR::LEMON - Graph Library

Changeset 552:83c22ca968d8 in lemon-0.x for src


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

top-sort, for fezso's sake

Location:
src/work/marci
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/work/marci/bfs_dfs_misc.h

    r549 r552  
    5151        dfs.pushAndSetReached(n);
    5252        while (!dfs.finished()) {
     53          ++dfs;
    5354          if (dfs.isANodeExamined()) {
    5455            l.push_back(dfs.aNode());
    5556          }
    56           ++dfs;
    5757        }
    5858      }
  • src/work/marci/top_sort.dim

    r549 r552  
    1 p mat 5 4
     1p mat 5 5
    22a 1 3
    33a 2 3
    44a 3 5
    55a 3 4
     6a 5 4
  • src/work/marci/top_sort_test.cc

    r549 r552  
    77#include <bfs_dfs_misc.h>
    88#include <list_graph.h>
     9#include <graph_wrapper.h>
    910
    1011using namespace hugo;
     
    1314  typedef ListGraph Graph;
    1415  Graph g;
    15   readDimacs(std::cin, g);
    16   std::list<Graph::Node> l;
    17   topSort(g, l);
    18   std::cout << "Leaving order of dfs which is pretopological..." << std::endl;
    19   for(std::list<Graph::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) {
    20     std::cout << *i << " ";
     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;
    2125  }
    22   std::cout << std::endl;
     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  }
    2338
    2439  return 0;
Note: See TracChangeset for help on using the changeset viewer.