6   if (Graph->GetNodes() > 1) {
 
    7     return double(Graph->GetNI(NId).GetDeg())/
double(Graph->GetNodes()-1); }
 
   12   TIntH NDistH(Graph->GetNodes());
 
   13   TSnap::GetShortPath<PUNGraph>(Graph, NId, NDistH, 
true, 
TInt::Mx);
 
   18   if (NDistH.Len() > 1) { 
return sum/double(NDistH.Len()-1); }
 
   24   if (Farness != 0.0) { 
return 1.0/Farness; }
 
   29   if (DoNodeCent) { NodeBtwH.
Clr(); }
 
   30   if (DoEdgeCent) { EdgeBtwH.
Clr(); }
 
   31   const int nodes = Graph->GetNodes();
 
   36   TIntH sigma(nodes), d(nodes);
 
   40       NodeBtwH.
AddDat(NI.GetId(), 0); }
 
   42       for (
int e = 0; e < NI.GetOutDeg(); e++) {
 
   43         if (NI.GetId() < NI.GetOutNId(e)) {
 
   44           EdgeBtwH.
AddDat(
TIntPr(NI.GetId(), NI.GetOutNId(e)), 0); }
 
   47     sigma.AddDat(NI.GetId(), 0);
 
   50     delta.
AddDat(NI.GetId(), 0);
 
   53   for (
int k=0; k < BtwNIdV.
Len(); k++) {
 
   56     for (
int i = 0; i < sigma.Len(); i++) {
 
   57       sigma[i]=0;  d[i]=-1;  delta[i]=0;  P[i].
Clr(
false);
 
   61     sigma.AddDat(NI.
GetId(), 1);
 
   65       const int v = Q.
Top();  Q.
Pop();
 
   68       const int VDat = d.
GetDat(v);
 
   69       for (
int e = 0; e < NI2.
GetOutDeg(); e++) {
 
   76         if (d.
GetDat(w) == VDat+1) {
 
   77           sigma.AddDat(w) += sigma.GetDat(v);
 
   83       const int w = S.
Top();
 
   84       const double SigmaW = sigma.GetDat(w);
 
   85       const double DeltaW = delta.
GetDat(w);
 
   88       for (
int i = 0; i < NIdV.
Len(); i++) {
 
   89         const int nid = NIdV[i];
 
   90         const double c = (sigma.GetDat(nid)*1.0/SigmaW) * (1+DeltaW);
 
   95       if (DoNodeCent && w != NI.
GetId()) {
 
  105   TIntV NIdV;  Graph->GetNIdV(NIdV);
 
  106   if (NodeFrac < 1.0) { 
 
  108     for (
int i = 
int((1.0-NodeFrac)*NIdV.
Len()); i > 0; i--) {
 
  116   TIntV NIdV;  Graph->GetNIdV(NIdV);
 
  117   if (NodeFrac < 1.0) { 
 
  119     for (
int i = 
int((1.0-NodeFrac)*NIdV.
Len()); i > 0; i--) {
 
  126   TIntV NIdV;  Graph->GetNIdV(NIdV);
 
  127   if (NodeFrac < 1.0) { 
 
  129     for (
int i = 
int((1.0-NodeFrac)*NIdV.
Len()); i > 0; i--) {
 
  136   const int NNodes = Graph->GetNodes();
 
  137   NIdEigenH.
Gen(NNodes);
 
  140     NIdEigenH.
AddDat(NI.GetId(), 1.0/NNodes);
 
  144   for (
int iter = 0; iter < MaxIter; iter++) {
 
  147     for (
TUNGraph::TNodeI NI = Graph->BegNI(); NI < Graph->EndNI(); NI++, j++) {
 
  149       for (
int e = 0; e < NI.GetOutDeg(); e++) {
 
  150         TmpV[j] += NIdEigenH.
GetDat(NI.GetOutNId(e)); }
 
  155     for (
int i = 0; i < TmpV.
Len(); i++) {
 
  156       sum += (TmpV[i]*TmpV[i]);
 
  159     for (
int i = 0; i < TmpV.
Len(); i++) {
 
  166     for (
TUNGraph::TNodeI NI = Graph->BegNI(); NI < Graph->EndNI(); NI++, j++) {
 
  167       diff += fabs(NIdEigenH.
GetDat(NI.GetId())-TmpV[j]);
 
  172     for (
TUNGraph::TNodeI NI = Graph->BegNI(); NI < Graph->EndNI(); NI++, j++) {
 
  173       NIdEigenH.
AddDat(NI.GetId(), TmpV[j]);
 
static const T & Mn(const T &LVal, const T &RVal)
 
TPair< TInt, TInt > TIntPr
 
double GetDegreeCentr(const PUNGraph &Graph, const int &NId)
 
static const T & Mx(const T &LVal, const T &RVal)
 
TSizeTy Len() const 
Returns the number of elements in the vector. 
 
void GetBetweennessCentr(const PUNGraph &Graph, const TIntV &BtwNIdV, TIntFltH &NodeBtwH, const bool &DoNodeCent, TIntPrFltH &EdgeBtwH, const bool &DoEdgeCent)
 
Node iterator. Only forward iteration (operator++) is supported. 
 
void Clr(const bool &DoDel=false)
 
const TDat & GetDat(const TKey &Key) const 
 
int GetOutDeg() const 
Returns out-degree of the current node (returns same as value GetDeg() since the graph is undirected)...
 
void Gen(const int &ExpectVals)
 
double GetClosenessCentr(const PUNGraph &Graph, const int &NId)
 
int GetOutNId(const int &NodeN) const 
Returns ID of NodeN-th out-node (the node the current node points to). 
 
void Shuffle(TRnd &Rnd)
Randomly shuffles the elements of the vector. 
 
double GetFarnessCentr(const PUNGraph &Graph, const int &NId)
 
void Clr(const bool &DoDel=true, const int &NoDelLim=-1, const bool &ResetDat=true)
 
void Push(const TVal &Val)
 
void Clr(const bool &DoDel=true)
 
int GetId() const 
Returns ID of the current node. 
 
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element. 
 
void DelLast()
Removes the last element of the vector. 
 
void GetEigenVectorCentr(const PUNGraph &Graph, TIntFltH &NIdEigenH, const double &Eps, const int &MaxIter)
 
TDat & AddDat(const TKey &Key)
 
const TKey & GetKey(const int &KeyId) const