Beispiel #1
0
def cc_push_topo_operator(graph: Graph, changed, comp_current: np.ndarray, comp_old: np.ndarray, nid):
    if comp_old[nid] > comp_current[nid]:
        comp_old[nid] = comp_current[nid]
        # Indicates that update happened
        changed.update(True)
        for ii in graph.out_edge_ids_for_node(nid):
            dst = graph.out_edge_dst(ii)
            new_comp = comp_current[nid]
            # Push the minimum component to your neighbors
            atomic_min(comp_current, dst, new_comp)
Beispiel #2
0
def sssp_operator(g: Graph, dists: np.ndarray, edge_weights, item,
                  ctx: UserContext):
    if dists[item.src] < item.dist:
        return
    for ii in g.out_edge_ids_for_node(item.src):
        dst = g.out_edge_dst(ii)
        edge_length = edge_weights[ii]
        new_distance = edge_length + dists[item.src]
        old_distance = atomic_min(dists, dst, new_distance)
        if new_distance < old_distance:
            ctx.push((dst, new_distance))
Beispiel #3
0
 def f(out, i):
     atomic_min(out, 0, i)