SpanningTree::SpanningTree() { double sq = sqrt(CkNumPes()*4.0-3.0) - 1; // 1 + arity + arity*arity = CkNumPes() arity = (int)ceil(sq/2); calcParent(CkMyPe()); calcNumChildren(CkMyPe()); }
// Helper Functions void calcNumChildren(WordNode* w, int depth, int& aggregate){ if(depth>0){ --depth; std::set<WordNode*> next = w->getLinks(); int size = w->getLinks().size(); aggregate += 1; for(auto each : next){ calcNumChildren(each, depth, aggregate); } return; } return; }