Example #1
0
    void checkAddEdge(unsigned numOfVertices, Edge toBeAdded, Edges existing, Edges missing)
    {
        g.addEdge(toBeAdded);

        ASSERT_EQ(existing.size(), g.numOfEdges());
        ASSERT_EQ(numOfVertices, g.numOfVertices());
        for (auto elem : existing) ASSERT_TRUE(g.edgeExists(elem));
        for (auto elem : missing) ASSERT_FALSE(g.edgeExists(elem));
    }
Example #2
0
 void verifyMatching(BipartiteGraph g, unsigned expectedSize)
 {
     Matching matching = findMaximumMatching(g);
     typedef boost::unordered_set<unsigned> VertexSet;
     VertexSet first;
     VertexSet second;
     for (auto elem : matching)
     {
         ASSERT_TRUE(first.insert(elem.first).second);
         ASSERT_TRUE(second.insert(elem.second).second);
         ASSERT_TRUE(g.edgeExists(elem));
     }
     ASSERT_EQ(expectedSize, matching.size());
 }