test/bipartite_matching_test.cc
changeset 2472 fb60f631790b
parent 2462 7a096a6bf53a
child 2553 bfced05fa852
equal deleted inserted replaced
8:aaf612ce8245 9:02eea8f435e1
   134     }
   134     }
   135     max_cardinality = bpmatch.matchingSize();
   135     max_cardinality = bpmatch.matchingSize();
   136   }
   136   }
   137 
   137 
   138   {
   138   {
   139     Graph::UEdgeMap<bool> mm(graph);
   139     Graph::ANodeMap<UEdge> mm(graph);
   140 
   140 
   141     check(max_cardinality == maxBipartiteMatching(graph, mm),
   141     check(max_cardinality == maxBipartiteMatching(graph, mm),
   142           "WRONG MATCHING");
   142           "WRONG MATCHING");
   143     
   143     
   144     for (ANodeIt it(graph); it != INVALID; ++it) {
   144     for (BNodeIt it(graph); it != INVALID; ++it) {
   145       int num = 0;
   145       int num = 0;
   146       for (IncEdgeIt jt(graph, it); jt != INVALID; ++jt) {
   146       
   147         if (mm[jt]) ++num;
   147       for (IncEdgeIt jt(graph, it); jt != INVALID; ++jt) {
       
   148         if (mm[graph.aNode(jt)] == jt) ++num;
       
   149       }
       
   150       check(num <= 1, "INVALID PRIMAL");
       
   151     }
       
   152   }
       
   153 
       
   154   {
       
   155     Graph::ANodeMap<UEdge> mm(graph);
       
   156 
       
   157     check(max_cardinality == prBipartiteMatching(graph, mm),
       
   158           "WRONG MATCHING");
       
   159     
       
   160     for (BNodeIt it(graph); it != INVALID; ++it) {
       
   161       int num = 0;
       
   162       
       
   163       for (IncEdgeIt jt(graph, it); jt != INVALID; ++jt) {
       
   164         if (mm[graph.aNode(jt)] == jt) ++num;
   148       }
   165       }
   149       check(num <= 1, "INVALID PRIMAL");
   166       check(num <= 1, "INVALID PRIMAL");
   150     }
   167     }
   151   }
   168   }
   152 
   169