Beispiel #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
Beispiel #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
Beispiel #3
0
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)
Beispiel #4
0
 def f(out, i):
     atomic_add(out, 0, i)