예제 #1
0
def count_in_and_out_degree(graph: Graph, nout, nin, nid):
    out_degree = 0
    for edge in graph.out_edge_ids_for_node(nid):
        out_degree += 1
        dst = graph.out_edge_dst(edge)
        atomic_add(nin, dst, 1)
    nout[nid] = out_degree
예제 #2
0
def count_weighted_in_and_out_degree(graph: Graph, nout, nin, weight_array, nid):
    out_degree = 0
    for edge in graph.out_edge_ids(nid):
        weight = weight_array[edge]
        out_degree += weight
        dst = graph.out_edge_dst(edge)
        atomic_add(nin, dst, weight)
    nout[nid] = out_degree
예제 #3
0
파일: pagerank.py 프로젝트: witchel/katana
def compute_out_deg_operator(graph: Graph, nout, nid):
    """Operator for computing outdegree of nodes in the Graph"""
    for ii in graph.out_edge_ids_for_node(nid):
        dst = graph.out_edge_dst(ii)
        atomic_add(nout, dst, 1)
예제 #4
0
파일: test_atomic.py 프로젝트: bowu/katana
 def f(out, i):
     atomic_add(out, 0, i)