7 template<
typename PGraph> 
double GetModularity(
const PGraph& G, 
const TIntV& NIdV, 
int GEdges=-1);
 
   10 template<
typename PGraph> 
double GetModularity(
const PGraph& G, 
const TCnComV& CmtyV, 
int GEdges=-1);
 
   14 template<
typename PGraph> 
void GetEdgesInOut(
const PGraph& Graph, 
const TIntV& NIdV, 
int& EdgesInX, 
int& EdgesOutX);
 
   29 namespace TSnapDetail {
 
   36 template<
typename PGraph>
 
   38   if (GEdges == -1) { GEdges = Graph->GetEdges(); }
 
   39   double EdgesIn = 0.0, EEdgesIn = 0.0; 
 
   41   for (
int e = 0; e < NIdV.
Len(); e++) { 
 
   43   for (
int e1 = 0; e1 < NIdV.
Len(); e1++) {
 
   44     typename PGraph::TObj::TNodeI NI = Graph->GetNI(NIdV[e1]);
 
   45     EEdgesIn += NI.GetOutDeg();
 
   46     for (
int i = 0; i < NI.GetOutDeg(); i++) {
 
   47       if (NIdSet.IsKey(NI.GetOutNId(i))) { EdgesIn += 1; }
 
   50   EEdgesIn = EEdgesIn*EEdgesIn/(2.0*GEdges);
 
   51   if ((EdgesIn - EEdgesIn) == 0) { 
return 0; }
 
   52   else { 
return (EdgesIn - EEdgesIn) / (2.0*GEdges); } 
 
   55 template<
typename PGraph>
 
   57   if (GEdges == -1) { GEdges = G->GetEdges(); }
 
   58   double Modularity = 0;
 
   59   for (
int c = 0; c < CmtyV.
Len(); c++) {
 
   65 template<
typename PGraph>
 
   70   for (
int e = 0; e < NIdV.
Len(); e++) {
 
   72   for (
int e = 0; e < NIdV.
Len(); e++) {
 
   73     typename PGraph::TObj::TNodeI NI = Graph->GetNI(NIdV[e]);
 
   74     for (
int i = 0; i < NI.GetOutDeg(); i++) {
 
   75       if (NIdSet.IsKey(NI.GetOutNId(i))) { EdgesIn += 1; }
 
   76       else { EdgesOut += 1; }
 
double CommunityGirvanNewman(PUNGraph &Graph, TCnComV &CmtyV)
 
TSizeTy Len() const 
Returns the number of elements in the vector. 
 
void GetEdgesInOut(const PGraph &Graph, const TIntV &NIdV, int &EdgesInX, int &EdgesOutX)
 
int AddKey(const TKey &Key)
 
double GetModularity(const PGraph &G, const TIntV &NIdV, int GEdges=-1)
 
double CommunityCNM(const PUNGraph &Graph, TCnComV &CmtyV)
 
double Infomap(PUNGraph &Graph, TCnComV &CmtyV)
 
void CmtyGirvanNewmanStep(PUNGraph &Graph, TIntV &Cmty1, TIntV &Cmty2)
A single step of Girvan-Newman clustering procedure.