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())
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()
def test_rooted_product_raises(): nx.rooted_product(nx.Graph(), nx.path_graph(2), 10)
def test_rooted_product_raises(): with pytest.raises(nx.NetworkXError): nx.rooted_product(nx.Graph(), nx.path_graph(2), 10)