Esempio n. 1
0
def test_rooted_product():
    G = nx.cycle_graph(5)
    H = nx.Graph()
    H.add_edges_from([('a', 'b'), ('b', 'c'), ('b', 'd')])
    R = nx.rooted_product(G, H, 'a')
    assert_equal(len(R), len(G) * len(H))
    assert_equal(R.size(), G.size() + len(G) * H.size())
Esempio n. 2
0
def test_rooted_product():
    G = nx.cycle_graph(5)
    H = nx.Graph()
    H.add_edges_from([("a", "b"), ("b", "c"), ("b", "d")])
    R = nx.rooted_product(G, H, "a")
    assert len(R) == len(G) * len(H)
    assert R.size() == G.size() + len(G) * H.size()
Esempio n. 3
0
def test_rooted_product():
    G = nx.cycle_graph(5)
    H = nx.Graph()
    H.add_edges_from([('a', 'b'), ('b', 'c'), ('b', 'd')])
    R = nx.rooted_product(G, H, 'a')
    assert_equal(len(R), len(G) * len(H))
    assert_equal(R.size(), G.size() + len(G) * H.size())
Esempio n. 4
0
def test_rooted_product_raises():
    nx.rooted_product(nx.Graph(), nx.path_graph(2), 10)
Esempio n. 5
0
def test_rooted_product_raises():
    with pytest.raises(nx.NetworkXError):
        nx.rooted_product(nx.Graph(), nx.path_graph(2), 10)
Esempio n. 6
0
def test_rooted_product_raises():
    nx.rooted_product(nx.Graph(), nx.path_graph(2), 10)