65 TakeStat(Graph, Time, StatFSet, GraphName); }
70 return new TGStat(Time, GraphName); }
112 template <
class PGraph>
void TakeStat(
const PGraph& Graph,
const TSecTm& Time,
TFSet StatFSet,
const TStr& GraphName);
113 template <
class PGraph>
void TakeBasicStat(
const PGraph& Graph,
const bool& IsMxWcc=
false);
114 template <
class PGraph>
void TakeBasicStat(
const PGraph& Graph,
TFSet FSet,
const bool& IsMxWcc=
false);
115 template <
class PGraph>
void TakeSccStat(
const PGraph& Graph,
TFSet StatFSet);
116 template <
class PGraph>
void TakeBccStat(
const PGraph& Graph,
TFSet StatFSet);
117 template <
class PGraph>
void TakeDegDistr(
const PGraph& Graph);
119 template <
class PGraph>
void TakeDiam(
const PGraph& Graph,
const bool& IsMxWcc=
false);
120 template <
class PGraph>
void TakeDiam(
const PGraph& Graph,
TFSet StatFSet,
const bool& IsMxWcc=
false);
121 template <
class PGraph>
void TakeConnComp(
const PGraph& Graph);
123 template <
class PGraph>
void TakeClustCf(
const PGraph& Graph,
const int& SampleNodes=-1);
124 template <
class PGraph>
void TakeTriadPart(
const PGraph& Graph);
129 void Plot(
const TFSet& FSet,
const TStr& FNmPref,
const TStr& Desc=
TStr(),
bool PowerFit=
false)
const;
218 template <
class PGraph>
220 printf(
"**TakeStat: G(%u, %u)\n", Graph->GetNodes(), Graph->GetEdges());
238 PNGraph NGraph = TSnap::ConvertGraph<PNGraph>(Graph,
true);
252 printf(
"**[%s]\n", FullTm.GetTmStr());
256 template <
class PGraph>
261 template <
class PGraph>
268 const int Nodes = Graph->GetNodes();
284 printf(
"basic wcc...");
285 const int Nodes = Graph->GetNodes();
300 template <
class PGraph>
305 template <
class PGraph>
322 printf(
"[%s] ", ExeTm.
GetTmStr()); }
325 template <
class PGraph>
331 template <
class PGraph>
350 HopsV.Gen(DistNbrsV.
Len(), 0);
351 for (
int i = 0; i < DistNbrsV.
Len(); i++) {
352 HopsV.Add(
TFltPr(DistNbrsV[i].Key(), DistNbrsV[i].Dat)); }
382 WccHopsV.Gen(DistNbrsV.
Len(), 0);
383 for (
int i = 0; i < DistNbrsV.
Len(); i++) {
384 WccHopsV.Add(
TFltPr(DistNbrsV[i].Key(), DistNbrsV[i].Dat)); }
391 template <
class PGraph>
396 template <
class PGraph>
404 WccSzCntV.
Gen(WccSzCntV1.
Len(), 0);
405 for (
int i = 0; i < WccSzCntV1.
Len(); i++)
406 WccSzCntV.
Add(
TFltPr(WccSzCntV1[i].Val1(), WccSzCntV1[i].Val2()));
413 SccSzCntV.
Gen(SccSzCntV1.
Len(), 0);
414 for (
int i = 0; i < SccSzCntV1.
Len(); i++)
415 SccSzCntV.
Add(
TFltPr(SccSzCntV1[i].Val1(), SccSzCntV1[i].Val2()));
420 template <
class PGraph>
433 template <
class PGraph>
446 template <
class PGraph>
449 printf(
"clustcf...");
452 const double ClustCf =
TSnap::GetClustCf(Graph, ClustCfV, Close, Open, SampleNodes);
459 template <
class PGraph>
462 printf(
"triadparticip...");
466 TriadCntV.
Gen(CntV.
Len(), 0);
467 for (
int i = 0; i < CntV.
Len(); i++) {
468 TriadCntV.
Add(
TFltPr(CntV[i].Val1(), CntV[i].Val2()));
bool HasVal(const TGStatVal &Stat) const
PGStat GetAvgGStat(const bool &ClipAt1=false)
static const TFltPrV EmptyV
PUNGraph GetMxBiCon(const PUNGraph &Graph, const bool &RenumberNodes)
Returns a graph representing the largest bi-connected component on an undirected Graph.
static TStr GetValStr(const TGStatVal &Val)
static PGStat New(const PNGraph &Graph, const TSecTm &Time, TFSet StatFSet=TFSet(), const TStr &GraphNm=TStr())
void ImposeDistr(const TGStatDistr &Distr, const TStr &FNmPref, TStr Desc=TStr(), const bool &ExpBin=false, const bool &PowerFit=false, const TGpSeriesTy &PlotWith=gpwLinesPoints, const TStr &Style="") const
void GetOutDegCnt(const PGraph &Graph, TIntPrV &DegToCntV)
Returns an out-degree histogram: a set of pairs (out-degree, number of nodes of such out-degree) ...
int GetBfsFullDiam(const PGraph &Graph, const int &NTestNodes, const bool &IsDir=false)
Returns the (approximation of the) Diameter (maximum shortest path length) of a graph (by performing ...
void Del(const TSizeTy &ValN)
Removes the element at position ValN.
PGraph GetMxWcc(const PGraph &Graph)
Returns a graph representing the largest weakly connected component on an input Graph.
void TakeSpectral(const PNGraph &Graph, const int _TakeSngVals=-1)
void Save(TSOut &SOut) const
static PGStat New(const PNEGraph &Graph, const TSecTm &Time, TFSet StatFSet=TFSet(), const TStr &GraphNm=TStr())
bool operator==(const TGStat &GStat) const
static TFSet NoDiamStat()
enum TGStatDistr_ TGStatDistr
TSizeTy Len() const
Returns the number of elements in the vector.
void TakeConnComp(const PGraph &Graph)
void PlotAllVsX(const TGStatVal &XVal, const TStr &OutFNm, TStr Desc=TStr(), const TGpScaleTy &Scale=gpsAuto, const bool &PowerFit=false) const
void GetAnf(const PGraph &Graph, const int &SrcNId, TIntFltKdV &DistNbrsV, const int &MxDist, const bool &IsDir, const int &NApprox=32)
static TFSet NoDistrStat()
void AvgGStat(const PGStatVec &GStatVec, const bool &ClipAt1=false)
TGStatVec & operator=(const TGStatVec &GStat)
uint GetInUnits(const TTmUnit &TmUnit) const
static TStr GetDistrStr(const TGStatDistr &Distr)
int GetTime(const TTmUnit &TimeUnit) const
int CntUniqDirEdges(const PGraph &Graph)
Counts unique directed edges in the graph Graph. Nodes (u,v)<.
bool HasDistr(const TGStatDistr &Distr) const
void Sort(const TGStatVal &SortBy=gsvNodes, const bool &Asc=true)
bool HasDistr(const TGStatDistr &Stat) const
void GetSccSzCnt(const PGraph &Graph, TIntPrV &SccSzCnt)
Returns a distribution of strongly connected component sizes.
static PGStat New(const PUNGraph &Graph, const TSecTm &Time, TFSet StatFSet=TFSet(), const TStr &GraphNm=TStr())
void SetTakeStat(const TFSet &TakeStatSet)
bool Empty() const
Tests whether the vector is empty.
have explicit edges (multigraph): TNEGraph, TNodeEdgeNet
enum TGStatVal_ TGStatVal
void SaveTxt(const TStr &FNmPref, const TStr &Desc) const
bool operator()(const TGStat &GS1, const TGStat &GS2) const
Graph Statistics Sequence.
int GetTime(const int &ValN) const
const char * GetTmStr() const
static TPlotInfo GetPlotInfo(const TGStatVal &Val)
void TakeStat(const PNGraph &Graph, const TSecTm &Time, TFSet StatFSet, const TStr &GraphName)
TCmpByVal(TGStatVal SortBy, bool Asc)
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
void TakeTriadPart(const PGraph &Graph)
void GetInDegCnt(const PGraph &Graph, TIntPrV &DegToCntV)
Returns an in-degree histogram: a set of pairs (in-degree, number of nodes of such in-degree) ...
void Add(const TFlt &Val, const TFlt &Wgt=1)
THash< TInt, TFltPrV > DistrStatH
Statistics of a Graph Snapshot.
void DelBefore(const TSecTm &Tm)
void TakeClustCf(const PGraph &Graph, const int &SampleNodes=-1)
static PGStat New(const TSecTm &Time=TSecTm(), const TStr &GraphName=TStr())
void DelSmallNodes(const int &MinNodes)
PGStat operator[](const int &ValN) const
TTmUnit GetTmUnit() const
bool HasVal(const TGStatVal &StatVal) const
TGStat(const PGraph &Graph, const TSecTm &Time, TFSet StatFSet=TFSet(), const TStr &GraphName=TStr())
void TakeBccStat(const PGraph &Graph, TFSet StatFSet)
void Del(const int &ValN)
const TVal & Last() const
Returns a reference to the last element of the vector.
PGStat New(const PGraph &Graph, const TSecTm &Time, TFSet StatFSet=TFSet(), const TStr &GraphNm=TStr())
TGStatVec(const TTmUnit &_TmUnit=tmu1Sec)
static uint MinNodesEdges
int CntUniqBiDirEdges(const PGraph &Graph)
Counts unique bidirectional edges in the graph Graph. Edge is bidirectional is there exist directed e...
TPair< TFlt, TFlt > TFltPr
void SetVal(const TGStatVal &StatVal, const double &Val)
void Save(TSOut &SOut) const
int CntInDegNodes(const PGraph &Graph, const int &NodeInDeg)
Returns the number of nodes with in-degree NodeInDeg.
void Add(const PGStat &Growth)
directed graph (TNGraph, TNEGraph), else graph is undirected TUNGraph
void SetNm(const TStr &GraphName)
double CalcEffDiam(const TIntFltKdV &DistNbrsCdfV, const double &Percentile)
Helper function for computing a given Percentile of a (unnormalized) cumulative distribution function...
PGStat At(const int &ValN) const
const TGStatV & GetGStatV() const
void PlotAll(const TStr &FNmPref, TStr Desc=TStr(), bool PowerFit=false) const
TStr GetStr(const TLoc &Loc=lUs) const
TQuad< TStr, TStr, TStr, TGpScaleTy > TPlotInfo
void DelAfter(const TSecTm &Tm)
void GetTriadParticip(const PGraph &Graph, TIntPrV &TriadCntV)
Triangle Participation Ratio: For each node counts how many triangles it participates in and then ret...
void GetValV(const TGStatVal &XVal, const TGStatVal &YVal, TFltPrV &ValV) const
void Plot(const TGStatDistr &Distr, const TStr &FNmPref, TStr Desc=TStr(), bool PowerFit=false) const
TGStat & operator=(const TGStat &GStat)
double GetClustCf(const PGraph &Graph, int SampleNodes=-1)
Computes the average clustering coefficient as defined in Watts and Strogatz, Collective dynamics of ...
void SetTm(const TSecTm &GraphTm)
void SetTmUnit(const TTmUnit &TimeUnit)
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
TGStat(const TSecTm &GraphTm=TSecTm(), const TStr &GraphName=TStr())
void TakeSccStat(const PGraph &Graph, TFSet StatFSet)
double GetVal(const TGStatVal &StatVal) const
static PGStatVec Load(TSIn &SIn)
int CntDegNodes(const PGraph &Graph, const int &NodeDeg)
Returns the number of nodes with degree NodeDeg.
static PGStatVec New(const TTmUnit &_TmUnit=tmu1Sec)
static PGStat Load(TSIn &SIn)
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
void SetDistr(const TGStatDistr &Distr, const TFltPrV &FltPrV)
void DelLast()
Removes the last element of the vector.
TPt< TGStatVec > PGStatVec
void GetWccSzCnt(const PGraph &Graph, TIntPrV &WccSzCnt)
Returns a distribution of weakly connected component sizes.
void Plot(const TGStatVal &XVal, const TGStatVal &YVal, const TStr &OutFNm, TStr &Desc, const TGpScaleTy &Scale=gpsAuto, const bool &PowerFit=false) const
bool operator<(const TGStat &GStat) const
const TFltPrV & GetDistr(const TGStatDistr &Distr) const
int CntOutDegNodes(const PGraph &Graph, const int &NodeOutDeg)
Returns the number of nodes with out-degree NodeOutDeg.
PGraph GetMxScc(const PGraph &Graph)
Returns a graph representing the largest strongly connected component on an input Graph...
void TakeDegDistr(const PGraph &Graph)
void TakeBasicStat(const PGraph &Graph, const bool &IsMxWcc=false)
void TakeDiam(const PGraph &Graph, const bool &IsMxWcc=false)
bool In(const int &FlagN) const