COIN-OR::LEMON - Graph Library

Changeset 2205:c20b0eb92a33 in lemon-0.x for test/unionfind_test.cc


Ignore:
Timestamp:
09/06/06 13:17:12 (13 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2930
Message:

UnionFind?
Changing the representation of the union-find
it has the same running time but it takes just 2/3 space
! does not auto insert items /performance/

UnionFindEnum?
Changing the interface - more convenient to UnionFind?
Does not based on the stl data structures /it could be disadvantage/

=> does not use singular iterator assignment /not stl conform, but always work/

Just new iterator interface

MaxMatching? + UnionFindTest?
Using new iterator interface instead of the old

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/unionfind_test.cc

    r2005 r2205  
    2626using namespace std;
    2727
    28 template <typename T>
    29 class BaseMap : public StdMap<int,T> {};
    30 
    31 typedef UnionFindEnum<int, BaseMap> UFE;
     28typedef UnionFindEnum<int, StdMap<int, int> > UFE;
    3229
    3330void print(UFE const &ufe) {
    34   UFE::ClassIt cit;
    3531  cout << "Print the classes of the structure:" << endl;
    3632  int i = 1;
    37   for (ufe.first(cit); ufe.valid(cit); ufe.next(cit)) {
     33  for (UFE::ClassIt cit(ufe); cit != INVALID; ++cit) {
    3834    cout << "  " << i << " (" << cit << "):" << flush;
    39     UFE::ItemIt iit;
    40     for (ufe.first(iit, cit); ufe.valid(iit); ufe.next(iit)) {
     35    for (UFE::ItemIt iit(ufe, cit); iit != INVALID; ++iit) {
    4136      cout << " " << iit << flush;
    4237    }
     
    4944
    5045int main() {
    51   UFE::MapType base;
     46  StdMap<int, int> base;
    5247  UFE U(base);
    5348
     
    7671  U.insert(9);
    7772  U.insert(10,9);
     73
    7874  check(U.join(8,10),"Test failed.");
    7975
Note: See TracChangeset for help on using the changeset viewer.