Exemplo n.º 1
0
def test_path_graph():
    G = nx.path_graph(4)
    answer = {0: 0.5, 1: 0.5, 2: 0.5, 3: 0.5}
    assert_equal(nx.bipartite_clustering(G, mode="dot"), answer)
    assert_equal(nx.bipartite_clustering(G, mode="max"), answer)
    answer = {0: 1, 1: 1, 2: 1, 3: 1}
    assert_equal(nx.bipartite_clustering(G, mode="min"), answer)
Exemplo n.º 2
0
def test_path_graph():
    G = nx.path_graph(4)
    answer = {0: 0.5, 1: 0.5, 2: 0.5, 3: 0.5}
    assert_equal(nx.bipartite_clustering(G, mode='dot'), answer)
    assert_equal(nx.bipartite_clustering(G, mode='max'), answer)
    answer = {0: 1, 1: 1, 2: 1, 3: 1}
    assert_equal(nx.bipartite_clustering(G, mode='min'), answer)
Exemplo n.º 3
0
def test_star_graph():
    G = nx.star_graph(3)
    # all modes are the same
    answer = {0: 0, 1: 1, 2: 1, 3: 1}
    assert_equal(nx.bipartite_clustering(G, mode="dot"), answer)
    assert_equal(nx.bipartite_clustering(G, mode="min"), answer)
    assert_equal(nx.bipartite_clustering(G, mode="max"), answer)
Exemplo n.º 4
0
def test_star_graph():
    G = nx.star_graph(3)
    # all modes are the same
    answer = {0: 0, 1: 1, 2: 1, 3: 1}
    assert_equal(nx.bipartite_clustering(G, mode='dot'), answer)
    assert_equal(nx.bipartite_clustering(G, mode='min'), answer)
    assert_equal(nx.bipartite_clustering(G, mode='max'), answer)