コード例 #1
0
def count_in_and_out_degree(graph: PropertyGraph, nout, nin, nid):
    out_degree = 0
    for edge in graph.edges(nid):
        out_degree += 1
        dst = graph.get_edge_dest(edge)
        atomic_add(nin, dst, 1)
    nout[nid] = out_degree
コード例 #2
0
def count_weighted_in_and_out_degree(graph: PropertyGraph, nout, nin,
                                     weight_array, nid):
    out_degree = 0
    for edge in graph.edges(nid):
        weight = weight_array[edge]
        out_degree += weight
        dst = graph.get_edge_dest(edge)
        atomic_add(nin, dst, weight)
    nout[nid] = out_degree
コード例 #3
0
 def f(out, i):
     atomic_add(out, 0, i)
コード例 #4
0
def compute_out_deg_operator(graph: PropertyGraph, nout, nid):
    """Operator for computing outdegree of nodes in the Graph"""
    for ii in graph.edges(nid):
        dst = graph.get_edge_dest(ii)
        atomic_add(nout, dst, 1)