6 namespace TSnapDetail {
18 int deg = NI.GetDeg();
28 double Zbest = 99999900000000000;
32 for (
int k=0; k<nodes.
Len(); k++){
34 Z = Z + br - 1 - nodes[k];
48 out.
AddDat(it.GetKey(), cp);
58 int *NNodes =
new int[Graph->GetNodes()];
66 int deg = NI.GetDeg();
79 nodesIds.
AddDat(NI.GetKey(),NI.GetKey());
83 double Zbest = 99999900000000000;
87 for (
int k=0; k<nodes.
Len(); k++){
89 if (nodes[k]==nodes[k+1]){
90 int kmin=-2;
int knew=-1;
91 while (kmin < 999999 && kmin !=-1 ){
95 while(nodes[k]==nodes[knew] && knew < nodes.
Len()-1){
96 int inter =
Intersect(Graph->GetNI(nodesIds[knew]),NNodes,NNodes_br);
97 int deg = nodes[knew];
99 if ((deg-inter)<kmin && !GroupNodes.
IsKey(nodesIds[knew]))
101 kmin = deg-inter; kind = knew;
109 Z = Z + br - 1 - nodes[kind];
117 int id = nodesIds[kind];
119 NNodes[NNodes_br] = id;
132 Z = Z + br - 1 - nodes[k];
140 int id = nodesIds[k];
142 NNodes[NNodes_br] = id;
150 Z = Z + br - 1 - nodes[k];
158 int id = nodesIds[k];
160 NNodes[NNodes_br] = id;
169 if (GroupNodes.
IsKey(it.GetKey()))
173 out.
AddDat(it.GetKey(), cp);
183 return GroupNodes.
Len();
190 int i = EI.GetSrcNId();
191 int j = EI.GetDstNId();
202 return sum/(((coresize*coresize)-coresize)/2);
206 int br_core1=0,br_periphery1=0,br_core_per1=0;
208 int i = EI.GetSrcNId();
209 int j = EI.GetDstNId();
219 double core_quality = (double)br_core1/((((
double)coresize*(
double)coresize)-(double)coresize)/2);
220 int per_size = Graph->GetNodes()-coresize;
221 double periphery_quality = (((((double)per_size*(
double)per_size)-(
double)per_size)/2) - (double)br_periphery1)/((((double)per_size*(
double)per_size)-(
double)per_size)/2);
223 return (
double)(core_quality+periphery_quality);
Edge iterator. Only forward iteration (operator++) is supported.
int Intersect(TUNGraph::TNodeI Node, TIntH NNodes)
Intersect.
int FastCorePeripheryGC(PUNGraph &Graph, TIntIntH &out)
Node iterator. Only forward iteration (operator++) is supported.
double BorgattiEverettMeasure(PUNGraph &Graph, TIntIntH &out, double coresize, int type)
int FastCorePeriphery(PUNGraph &Graph, TIntIntH &out)
const TDat & GetDat(const TKey &Key) const
bool IsEnd() const
Tests whether the iterator is pointing to the past-end element.
double PearsonCorrelation(PUNGraph &Graph, TIntIntH &out, int coresize)
bool IsKey(const TKey &Key) const
TDat & AddDat(const TKey &Key)
void SortByDat(const bool &Asc=true)