void randomClusterGraph(ClusterGraph &C,Graph &G,int cNum) { int n = G.numberOfNodes(); //int m = G.numberOfEdges(); node v; int count = 0; NodeArray<int> num(G); Array<node> numNode(0,n-1,0); forall_nodes(v,G) { num[v] = count; numNode[count] = v; count++; }
// finding the number of nodes in a tree int numNode (TreeNodePtr root){ if(root == NULL) return 0; return 1 + numNode(root->leftPtr) + numNode(root->rightPtr); }