def cc_push_topo_operator(graph: PropertyGraph, 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.edges(nid): dst = graph.get_edge_dst(ii) new_comp = comp_current[nid] # Push the minimum component to your neighbors atomic_min(comp_current, dst, new_comp)
def sssp_operator(g: PropertyGraph, dists: np.ndarray, edge_weights, item, ctx: UserContext): if dists[item.src] < item.dist: return for ii in g.edges(item.src): dst = g.get_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))
def f(out, i): atomic_min(out, 0, i)