def cc_pull_topo_operator(graph: PropertyGraph, changed, comp_current: np.ndarray, nid): for ii in graph.edges(nid): dst = graph.get_edge_dst(ii) # Pull the minimum component from your neighbors if comp_current[nid] > comp_current[dst]: comp_current[nid] = comp_current[dst] # Indicates that update happened changed.update(True)
def compute_async_kcore_operator(graph: PropertyGraph, current_degree, k_core_num, nid, ctx): # Decrement degree of all the neighbors of dead node for ii in graph.edges(nid): dst = graph.get_edge_dst(ii) old_degree = atomic_sub(current_degree, dst, 1) # Add new dead nodes to the worklist if old_degree == k_core_num: ctx.push(dst)
def compute_pagerank_pull_residual_operator(graph: PropertyGraph, delta, residual, nid): sum = 0 for ii in graph.edges(nid): dst = graph.get_edge_dst(ii) if delta[dst] > 0: sum += delta[dst] if sum > 0: residual[nid] = sum
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 bfs_sync_operator_pg( graph: PropertyGraph, next_level: InsertBag[np.uint64], next_level_number: int, distance: np.ndarray, nid, ): num_nodes = graph.num_nodes() for ii in graph.edges(nid): dst = graph.get_edge_dst(ii) if distance[dst] == num_nodes: distance[dst] = next_level_number next_level.push(dst)
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 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_dst(ii) atomic_add(nout, dst, 1)