Exemplo n.º 1
0
def test_graph_degree():
    "Graph: Graph Degree"
    A = rand_dm(25, 0.1)
    deg = graph_degree(A.data)
    A = A.full()
    np_deg = []
    for k in range(25):
        num = 0
        inds = A[k, :].nonzero()[0]
        num = len(inds)
        if k in inds:
            num += 1
        np_deg.append(num)
    np.asarray(np_deg, dtype=int)
    assert_equal((deg - np_deg).all(), 0)
Exemplo n.º 2
0
def test_graph_degree():
    "Graph: Graph Degree"
    A = rand_dm(25, 0.1)
    deg = graph_degree(A.data)
    A = A.full()
    np_deg = []
    for k in range(25):
        num = 0
        inds = A[k, :].nonzero()[0]
        num = len(inds)
        if k in inds:
            num += 1
        np_deg.append(num)
    np.asarray(np_deg, dtype=int)
    assert_equal((deg - np_deg).all(), 0)