void Compute(graph<vertex>& GA, commandLine P) { long n = GA.n; uintE* IDs = newA(uintE,n), *prevIDs = newA(uintE,n); {parallel_for(long i=0;i<n;i++) IDs[i] = i;} //initialize unique IDs bool* frontier = newA(bool,n); {parallel_for(long i=0;i<n;i++) frontier[i] = 1;} vertexSubset Frontier(n,n,frontier); //initial frontier contains all vertices while(!Frontier.isEmpty()){ //iterate until IDS converge vertexMap(Frontier,CC_Vertex_F(IDs,prevIDs)); vertexSubset output = edgeMap(GA, Frontier, CC_F(IDs,prevIDs),GA.m/20); Frontier.del(); Frontier = output; } Frontier.del(); free(IDs); free(prevIDs); }
void Compute(graph<vertex>& GA, commandLine P) { long n = GA.n, m = GA.m; uintE* IDs = newA(uintE,n), *prevIDs = newA(uintE,n); {parallel_for(long i=0;i<n;i++) {prevIDs[i] = i; IDs[i] = i;}} //initialize unique IDs bool* all = newA(bool,n); {parallel_for(long i=0;i<n;i++) all[i] = 1;} vertexSubset All(n,n,all); //all vertices bool* active = newA(bool,n); {parallel_for(long i=0;i<n;i++) active[i] = 1;} vertexSubset Active(n,n,active); //initial frontier contains all vertices while(!Active.isEmpty()){ //iterate until IDS converge edgeMap(GA, Active, CC_F(IDs,prevIDs),m/20,no_output); vertexSubset output = vertexFilter(All,CC_Shortcut(IDs,prevIDs)); Active.del(); Active = output; } Active.del(); All.del(); free(IDs); free(prevIDs); }