test/max_matching_test.cc
changeset 2505 1bb471764ab8
parent 2391 14a343be7a5a
child 2553 bfced05fa852
     1.1 --- a/test/max_matching_test.cc	Tue Oct 30 10:51:07 2007 +0000
     1.2 +++ b/test/max_matching_test.cc	Tue Oct 30 20:21:10 2007 +0000
     1.3 @@ -66,11 +66,12 @@
     1.4    g.addEdge(nodes[6], nodes[12]);
     1.5    
     1.6    MaxMatching<Graph> max_matching(g);
     1.7 -  max_matching.runEdmonds(0);
     1.8 +  max_matching.init();
     1.9 +  max_matching.startDense();
    1.10    
    1.11    int s=0;
    1.12    Graph::NodeMap<Node> mate(g,INVALID);
    1.13 -  max_matching.writeNMapNode(mate);
    1.14 +  max_matching.mateMap(mate);
    1.15    for(NodeIt v(g); v!=INVALID; ++v) {
    1.16      if ( mate[v]!=INVALID ) ++s;
    1.17    }
    1.18 @@ -82,43 +83,42 @@
    1.19  
    1.20    check ( size == max_matching.size(), "mate() returns a different size matching than max_matching.size()" );
    1.21  
    1.22 -  Graph::NodeMap<MaxMatching<Graph>::pos_enum> pos0(g);
    1.23 -  max_matching.writePos(pos0);
    1.24 +  Graph::NodeMap<MaxMatching<Graph>::DecompType> pos0(g);
    1.25 +  max_matching.decomposition(pos0);
    1.26    
    1.27 -  max_matching.resetMatching();
    1.28 -  max_matching.runEdmonds(1);
    1.29 +  max_matching.init();
    1.30 +  max_matching.startSparse();
    1.31    s=0;
    1.32 -  max_matching.writeNMapNode(mate);
    1.33 +  max_matching.mateMap(mate);
    1.34    for(NodeIt v(g); v!=INVALID; ++v) {
    1.35      if ( mate[v]!=INVALID ) ++s;
    1.36    }
    1.37    check ( int(s/2) == size, "The size does not equal!" );
    1.38  
    1.39 -  Graph::NodeMap<MaxMatching<Graph>::pos_enum> pos1(g);
    1.40 -  max_matching.writePos(pos1);
    1.41 +  Graph::NodeMap<MaxMatching<Graph>::DecompType> pos1(g);
    1.42 +  max_matching.decomposition(pos1);
    1.43  
    1.44    max_matching.run();
    1.45    s=0;
    1.46 -  max_matching.writeNMapNode(mate);
    1.47 +  max_matching.mateMap(mate);
    1.48    for(NodeIt v(g); v!=INVALID; ++v) {
    1.49      if ( mate[v]!=INVALID ) ++s;
    1.50    }
    1.51    check ( int(s/2) == size, "The size does not equal!" ); 
    1.52    
    1.53 -  Graph::NodeMap<MaxMatching<Graph>::pos_enum> pos2(g);
    1.54 -  max_matching.writePos(pos2);
    1.55 +  Graph::NodeMap<MaxMatching<Graph>::DecompType> pos2(g);
    1.56 +  max_matching.decomposition(pos2);
    1.57  
    1.58 -  max_matching.resetMatching();
    1.59    max_matching.run();
    1.60    s=0;
    1.61 -  max_matching.writeNMapNode(mate);
    1.62 +  max_matching.mateMap(mate);
    1.63    for(NodeIt v(g); v!=INVALID; ++v) {
    1.64      if ( mate[v]!=INVALID ) ++s;
    1.65    }
    1.66    check ( int(s/2) == size, "The size does not equal!" ); 
    1.67    
    1.68 -  Graph::NodeMap<MaxMatching<Graph>::pos_enum> pos(g);
    1.69 -  max_matching.writePos(pos);
    1.70 +  Graph::NodeMap<MaxMatching<Graph>::DecompType> pos(g);
    1.71 +  max_matching.decomposition(pos);
    1.72     
    1.73    bool ismatching=true;
    1.74    for(NodeIt v(g); v!=INVALID; ++v) {
    1.75 @@ -139,8 +139,10 @@
    1.76  
    1.77    bool noedge=true;
    1.78    for(UEdgeIt e(g); e!=INVALID; ++e) {
    1.79 -   if ( (pos[g.target(e)]==max_matching.C && pos[g.source(e)]==max_matching.D) || 
    1.80 -	 (pos[g.target(e)]==max_matching.D && pos[g.source(e)]==max_matching.C) )
    1.81 +   if ( (pos[g.target(e)]==max_matching.C && 
    1.82 +	 pos[g.source(e)]==max_matching.D) || 
    1.83 +	 (pos[g.target(e)]==max_matching.D && 
    1.84 +	  pos[g.source(e)]==max_matching.C) )
    1.85        noedge=false; 
    1.86    }
    1.87    check ( noedge, "There are edges between D and C!" );