Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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))
Ejemplo n.º 3
0
 def f(out, i):
     atomic_min(out, 0, i)