Example #1
0
def test_get_random_graph():
    A = nig.get_random_graph(10, weighted=False, directed=False)
    npt.assert_equal(A.shape[0], 10)
    A = nig.get_random_graph(10, weighted=True, directed=True)
    npt.assert_equal(A.shape[0], 10)
    A = nig.get_random_graph(10, weighted=True, directed=False, fmt='ig')
    npt.assert_equal(A.get_adjacency().shape[0], 10)
Example #2
0
def test_louvain():
    A = nig.get_random_graph(30, directed=False)
    n2c, extras = nig.louvain(A, weighted=False, return_tree=False)
    npt.assert_equal(A.shape[0], n2c.shape[0])
    n2c, extras = nig.louvain(A, weighted=False, return_tree=True)
    npt.assert_equal(A.shape[0], n2c.shape[1])
Example #3
0
def test_k_shell():
    A = nig.get_random_graph(30, directed=False)
    n2c, extras = nig.n2c, _ = nig.k_shell(A, only_core_periphery=False)
    npt.assert_equal(A.shape[0], n2c.shape[0])
    n2c, extras = nig.n2c, _ = nig.k_shell(A, only_core_periphery=True)
    npt.assert_equal(A.shape[0], n2c.shape[0])
Example #4
0
def test_label_propagation():
    A = nig.get_random_graph(30, directed=False)
    n2c, extras = nig.label_propagation(A)
    npt.assert_equal(A.shape[0], n2c.shape[0])
Example #5
0
def test_degree():
    A = nig.get_random_graph(30, directed=False)
    k = nig.degree(A, directed=False, ignore_self_loops=False)
    npt.assert_equal(A.shape[0], k.shape[0])