#include "../../snap-core/Snap.h" #include THashSet done; //BFS from starter and return the size of this connected component int bfs(PUNGraph g, int starter) { TQQueue q; int ccsize=0; q.Push(starter); ++ccsize; done.AddKey(starter); while (!q.Empty()) { TUNGraph::TNodeI p=g->GetNI(q.Top()); q.Pop(); for (int i=0; i(100, 100); printf("We have connected components of these sizes:\n"); for (int i=0; iGetNodes(); ++i) if (!done.IsKey(i)) //not BFSed yet { int ccsize = bfs(g, i); printf(" %d", ccsize); } printf("\n"); return 0; }