def test_eppstein_matching():
    """Test in accordance to issue #1927"""
    G = nx.Graph()
    G.add_nodes_from(['a', 2, 3, 4], bipartite=0)
    G.add_nodes_from([1, 'b', 'c'], bipartite=1)
    G.add_edges_from([('a', 1), ('a', 'b'), (2, 'b'),
                      (2, 'c'), (3, 'c'), (4, 1)])
    matching = eppstein_matching(G)
    assert_true(len(matching) == len(maximum_matching(G)))
    assert all(x in set(matching.keys()) for x in set(matching.values()))
Ejemplo n.º 2
0
def test_eppstein_matching():
    """Test in accordance to issue #1927"""
    G = nx.Graph()
    G.add_nodes_from(["a", 2, 3, 4], bipartite=0)
    G.add_nodes_from([1, "b", "c"], bipartite=1)
    G.add_edges_from([("a", 1), ("a", "b"), (2, "b"), (2, "c"), (3, "c"),
                      (4, 1)])
    matching = eppstein_matching(G)
    assert len(matching) == len(maximum_matching(G))
    assert all(x in set(matching.keys()) for x in set(matching.values()))
Ejemplo n.º 3
0
def test_eppstein_matching():
    """Test in accordance to issue #1927"""
    G = nx.Graph()
    G.add_nodes_from(['a', 2, 3, 4], bipartite=0)
    G.add_nodes_from([1, 'b', 'c'], bipartite=1)
    G.add_edges_from([('a', 1), ('a', 'b'), (2, 'b'),
                      (2, 'c'), (3, 'c'), (4, 1)])
    matching = eppstein_matching(G)
    assert_true(len(matching) == len(maximum_matching(G)))
    assert all(x in set(matching.keys()) for x in set(matching.values()))
 def test_eppstein_matching_disconnected(self):
     match = eppstein_matching(self.disconnected_graph)
 def test_eppstein_matching_simple(self):
     match = eppstein_matching(self.simple_graph)
     assert_equal(match, self.simple_solution)
    def test_eppstein_matching(self):
        """Tests that David Eppstein's implementation of the Hopcroft--Karp
        algorithm produces a maximum cardinality matching.

        """
        self.check_match(eppstein_matching(self.graph, self.top_nodes))
Ejemplo n.º 7
0
    def test_eppstein_matching(self):
        """Tests that David Eppstein's implementation of the Hopcroft--Karp
        algorithm produces a maximum cardinality matching.

        """
        self.check_match(eppstein_matching(self.graph))
Ejemplo n.º 8
0
 def test_eppstein_matching_disconnected(self):
     with pytest.raises(nx.AmbiguousSolution):
         match = eppstein_matching(self.disconnected_graph)
Ejemplo n.º 9
0
 def test_eppstein_matching_disconnected(self):
     match = eppstein_matching(self.disconnected_graph)
Ejemplo n.º 10
0
 def test_eppstein_matching_simple(self):
     match = eppstein_matching(self.simple_graph)
     assert_equal(match, self.simple_solution)