SNAP Library 4.0, Developer Reference  2017-07-27 13:18:06
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGStat Class Reference

Statistics of a Graph Snapshot. More...

#include <gstat.h>

Collaboration diagram for TGStat:

Classes

class  TCmpByVal
 

Public Types

typedef TQuad< TStr, TStr,
TStr, TGpScaleTy
TPlotInfo
 

Public Member Functions

 TGStat (const TSecTm &GraphTm=TSecTm(), const TStr &GraphName=TStr())
 
 TGStat (const PNGraph &Graph, const TSecTm &Time, TFSet StatFSet=TFSet(), const TStr &GraphName=TStr())
 
 TGStat (const PUNGraph &Graph, const TSecTm &Time, TFSet StatFSet=TFSet(), const TStr &GraphName=TStr())
 
 TGStat (const PNEGraph &Graph, const TSecTm &Time, TFSet StatFSet=TFSet(), const TStr &GraphName=TStr())
 
template<class PGraph >
 TGStat (const PGraph &Graph, const TSecTm &Time, TFSet StatFSet=TFSet(), const TStr &GraphName=TStr())
 
 TGStat (const TGStat &GStat)
 
 TGStat (TSIn &SIn)
 
void Save (TSOut &SOut) const
 
template<class PGraph >
PGStat New (const PGraph &Graph, const TSecTm &Time, TFSet StatFSet=TFSet(), const TStr &GraphNm=TStr())
 
PGStat Clone () const
 
TGStatoperator= (const TGStat &GStat)
 
bool operator== (const TGStat &GStat) const
 
bool operator< (const TGStat &GStat) const
 
int GetYear () const
 
int GetMonth () const
 
int GetDay () const
 
int GetHour () const
 
int GetMin () const
 
int GetSec () const
 
TStr GetTmStr () const
 
void SetTm (const TSecTm &GraphTm)
 
TStr GetNm () const
 
void SetNm (const TStr &GraphName)
 
int GetTime (const TTmUnit &TimeUnit) const
 
int GetVals () const
 
bool HasVal (const TGStatVal &StatVal) const
 
double GetVal (const TGStatVal &StatVal) const
 
void SetVal (const TGStatVal &StatVal, const double &Val)
 
int GetDistrs () const
 
bool HasDistr (const TGStatDistr &Distr) const
 
const TFltPrVGetDistr (const TGStatDistr &Distr) const
 
void GetDistr (const TGStatDistr &Distr, TFltPrV &FltPrV) const
 
void SetDistr (const TGStatDistr &Distr, const TFltPrV &FltPrV)
 
int GetNodes () const
 
int GetEdges () const
 
void TakeStat (const PNGraph &Graph, const TSecTm &Time, TFSet StatFSet, const TStr &GraphName)
 
void TakeStat (const PUNGraph &Graph, const TSecTm &Time, TFSet StatFSet, const TStr &GraphName)
 
template<class PGraph >
void TakeStat (const PGraph &Graph, const TSecTm &Time, TFSet StatFSet, const TStr &GraphName)
 
template<class PGraph >
void TakeBasicStat (const PGraph &Graph, const bool &IsMxWcc=false)
 
template<class PGraph >
void TakeBasicStat (const PGraph &Graph, TFSet FSet, const bool &IsMxWcc=false)
 
template<class PGraph >
void TakeSccStat (const PGraph &Graph, TFSet StatFSet)
 
template<class PGraph >
void TakeBccStat (const PGraph &Graph, TFSet StatFSet)
 
template<class PGraph >
void TakeDegDistr (const PGraph &Graph)
 
template<class PGraph >
void TakeDegDistr (const PGraph &Graph, TFSet StatFSet)
 
template<class PGraph >
void TakeDiam (const PGraph &Graph, const bool &IsMxWcc=false)
 
template<class PGraph >
void TakeDiam (const PGraph &Graph, TFSet StatFSet, const bool &IsMxWcc=false)
 
template<class PGraph >
void TakeConnComp (const PGraph &Graph)
 
template<class PGraph >
void TakeConnComp (const PGraph &Graph, TFSet StatFSet)
 
template<class PGraph >
void TakeClustCf (const PGraph &Graph, const int &SampleNodes=-1)
 
template<class PGraph >
void TakeTriadPart (const PGraph &Graph)
 
void TakeSpectral (const PNGraph &Graph, const int _TakeSngVals=-1)
 
void TakeSpectral (const PNGraph &Graph, TFSet StatFSet, int _TakeSngVals=-1)
 
void Plot (const TGStatDistr &Distr, const TStr &FNmPref, TStr Desc=TStr(), bool PowerFit=false) const
 
void Plot (const TFSet &FSet, const TStr &FNmPref, const TStr &Desc=TStr(), bool PowerFit=false) const
 
void PlotAll (const TStr &FNmPref, TStr Desc=TStr(), bool PowerFit=false) const
 
void DumpValStat ()
 
void AvgGStat (const PGStatVec &GStatVec, const bool &ClipAt1=false)
 
void AvgGStat (const TGStatV &GStatV, const bool &ClipAt1=false)
 

Static Public Member Functions

static PGStat New (const TSecTm &Time=TSecTm(), const TStr &GraphName=TStr())
 
static PGStat New (const PNGraph &Graph, const TSecTm &Time, TFSet StatFSet=TFSet(), const TStr &GraphNm=TStr())
 
static PGStat New (const PUNGraph &Graph, const TSecTm &Time, TFSet StatFSet=TFSet(), const TStr &GraphNm=TStr())
 
static PGStat New (const PNEGraph &Graph, const TSecTm &Time, TFSet StatFSet=TFSet(), const TStr &GraphNm=TStr())
 
static PGStat Load (TSIn &SIn)
 
static TStr GetDistrStr (const TGStatDistr &Distr)
 
static TStr GetValStr (const TGStatVal &Val)
 
static TPlotInfo GetPlotInfo (const TGStatVal &Val)
 
static TPlotInfo GetPlotInfo (const TGStatDistr &Distr)
 
static TFSet NoStat ()
 
static TFSet BasicStat ()
 
static TFSet DegDStat ()
 
static TFSet NoDiamStat ()
 
static TFSet NoDistrStat ()
 
static TFSet NoSvdStat ()
 
static TFSet AllStat ()
 

Public Attributes

TSecTm Time
 
TStr GraphNm
 
TIntFltH ValStatH
 
THash< TInt, TFltPrVDistrStatH
 

Static Public Attributes

static int NDiamRuns = 10
 
static int TakeSngVals = 100
 

Private Attributes

TCRef CRef
 

Static Private Attributes

static const TFltPrV EmptyV = TFltPrV()
 

Friends

class TCmpByVal
 
class TPt< TGStat >
 

Detailed Description

Statistics of a Graph Snapshot.

Definition at line 36 of file gstat.h.

Member Typedef Documentation

Definition at line 40 of file gstat.h.

Constructor & Destructor Documentation

TGStat::TGStat ( const TSecTm GraphTm = TSecTm(),
const TStr GraphName = TStr() 
)

Definition at line 21 of file gstat.cpp.

Referenced by Clone(), Load(), and New().

21  :
22  Time(GraphTm), GraphNm(GraphName), ValStatH(), DistrStatH() {
23 }
TStr GraphNm
Definition: gstat.h:56
TSecTm Time
Definition: gstat.h:55
THash< TInt, TFltPrV > DistrStatH
Definition: gstat.h:58
TIntFltH ValStatH
Definition: gstat.h:57

Here is the caller graph for this function:

TGStat::TGStat ( const PNGraph Graph,
const TSecTm Time,
TFSet  StatFSet = TFSet(),
const TStr GraphName = TStr() 
)

Definition at line 25 of file gstat.cpp.

References TakeStat().

25  {
26  TakeStat(Graph, GraphTm, StatFSet, GraphName);
27 }
void TakeStat(const PNGraph &Graph, const TSecTm &Time, TFSet StatFSet, const TStr &GraphName)
Definition: gstat.cpp:105

Here is the call graph for this function:

TGStat::TGStat ( const PUNGraph Graph,
const TSecTm Time,
TFSet  StatFSet = TFSet(),
const TStr GraphName = TStr() 
)

Definition at line 29 of file gstat.cpp.

References TakeStat().

29  {
30  TakeStat(Graph, GraphTm, StatFSet, GraphName);
31 }
void TakeStat(const PNGraph &Graph, const TSecTm &Time, TFSet StatFSet, const TStr &GraphName)
Definition: gstat.cpp:105

Here is the call graph for this function:

TGStat::TGStat ( const PNEGraph Graph,
const TSecTm Time,
TFSet  StatFSet = TFSet(),
const TStr GraphName = TStr() 
)

Definition at line 33 of file gstat.cpp.

References TakeStat().

33  {
34  TakeStat(Graph, GraphTm, StatFSet, GraphName);
35 }
void TakeStat(const PNGraph &Graph, const TSecTm &Time, TFSet StatFSet, const TStr &GraphName)
Definition: gstat.cpp:105

Here is the call graph for this function:

template<class PGraph >
TGStat::TGStat ( const PGraph &  Graph,
const TSecTm Time,
TFSet  StatFSet = TFSet(),
const TStr GraphName = TStr() 
)
inline

Definition at line 64 of file gstat.h.

References TakeStat().

64  {
65  TakeStat(Graph, Time, StatFSet, GraphName); }
void TakeStat(const PNGraph &Graph, const TSecTm &Time, TFSet StatFSet, const TStr &GraphName)
Definition: gstat.cpp:105

Here is the call graph for this function:

TGStat::TGStat ( const TGStat GStat)

Definition at line 36 of file gstat.cpp.

36  : Time(GStat.Time), GraphNm(GStat.GraphNm),
37  ValStatH(GStat.ValStatH), DistrStatH(GStat.DistrStatH) {
38 }
TStr GraphNm
Definition: gstat.h:56
TSecTm Time
Definition: gstat.h:55
THash< TInt, TFltPrV > DistrStatH
Definition: gstat.h:58
TIntFltH ValStatH
Definition: gstat.h:57
TGStat::TGStat ( TSIn SIn)

Definition at line 40 of file gstat.cpp.

40 : Time(SIn), GraphNm(SIn), ValStatH(SIn), DistrStatH(SIn) { }
TStr GraphNm
Definition: gstat.h:56
TSecTm Time
Definition: gstat.h:55
THash< TInt, TFltPrV > DistrStatH
Definition: gstat.h:58
TIntFltH ValStatH
Definition: gstat.h:57

Member Function Documentation

TFSet TGStat::AllStat ( )
static

Definition at line 401 of file gstat.cpp.

References gsdClustCf, gsdHops, gsdInDeg, gsdOutDeg, gsdScc, gsdSngVal, gsdSngVec, gsdTriadPart, gsdWcc, gsdWccHops, and gsvFullDiam.

Referenced by TFfGGen::GenFFGraphs(), main(), and TGStatVec::TGStatVec().

401  {
402  return TFSet() | gsdInDeg | gsdOutDeg | gsdWcc | gsdScc
405 }
Definition: gstat.h:28
Definition: bits.h:119
Definition: gstat.h:29
Definition: gstat.h:28
Definition: gstat.h:28

Here is the caller graph for this function:

void TGStat::AvgGStat ( const PGStatVec GStatVec,
const bool &  ClipAt1 = false 
)

Definition at line 243 of file gstat.cpp.

243  {
244  AvgGStat(GStatVec->GetGStatV(), ClipAt1);
245 }
void AvgGStat(const PGStatVec &GStatVec, const bool &ClipAt1=false)
Definition: gstat.cpp:243
void TGStat::AvgGStat ( const TGStatV GStatV,
const bool &  ClipAt1 = false 
)

Definition at line 247 of file gstat.cpp.

References TMom::Add(), THash< TKey, TDat, THashFunc >::AddDat(), TMom::Def(), TVec< TVal, TSizeTy >::Empty(), THash< TKey, TDat, THashFunc >::GetKeyDatPrV(), TMom::GetMean(), GetVal(), TMom::GetVals(), GraphNm, gsdMx, gsdUndef, gsvMx, HasDistr(), HasVal(), IAssert, TMom::IsUsable(), TVec< TVal, TSizeTy >::Len(), SetDistr(), SetVal(), and Time.

247  {
248  if (GStatV.Empty()) return;
249  Time = GStatV[0]->Time;
250  GraphNm = GStatV[0]->GraphNm;
251  // values
252  for (int statVal = 0; statVal > gsvMx; statVal++) {
253  const TGStatVal GStatVal = TGStatVal(statVal);
254  TMom Mom;
255  for (int i = 0; i < GStatV.Len(); i++) {
256  if (GStatV[i]->HasVal(GStatVal)) {
257  Mom.Add(GStatV[i]->GetVal(GStatVal)); }
258  }
259  Mom.Def();
260  if (Mom.IsUsable()) {
261  IAssert(Mom.GetVals() == GStatV.Len()); // all must have the value
262  SetVal(GStatVal, Mom.GetMean());
263  }
264  }
265  // distributions
266  for (int distr = gsdUndef; distr < gsdMx; distr++) {
267  const TGStatDistr GStatDistr = TGStatDistr(distr);
268  THash<TFlt, TFlt> ValToSumH;
269  int DistrCnt = 0;
270  for (int i = 0; i < GStatV.Len(); i++) {
271  if (GStatV[i]->HasDistr(GStatDistr)) {
272  const TFltPrV& D = GStatV[i]->GetDistr(GStatDistr);
273  for (int d = 0; d < D.Len(); d++) {
274  ValToSumH.AddDat(D[d].Val1) += D[d].Val2; }
275  DistrCnt++;
276  }
277  }
278  IAssert(DistrCnt==0 || DistrCnt==GStatV.Len()); // all must have distribution
279  TFltPrV AvgStatV;
280  ValToSumH.GetKeyDatPrV(AvgStatV); AvgStatV.Sort();
281  for (int i = 0; i < AvgStatV.Len(); i++) {
282  AvgStatV[i].Val2 /= double(DistrCnt);
283  if (ClipAt1 && AvgStatV[i].Val2 < 1) { AvgStatV[i].Val2 = 1; }
284  }
285  SetDistr(GStatDistr, AvgStatV);
286  }
287 }
#define IAssert(Cond)
Definition: bd.h:262
TStr GraphNm
Definition: gstat.h:56
int GetVals() const
Definition: xmath.h:220
enum TGStatDistr_ TGStatDistr
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TSecTm Time
Definition: gstat.h:55
Definition: xmath.h:129
bool HasDistr(const TGStatDistr &Distr) const
Definition: gstat.h:102
bool IsUsable() const
Definition: xmath.h:225
bool Empty() const
Tests whether the vector is empty.
Definition: ds.h:570
enum TGStatVal_ TGStatVal
Definition: gstat.h:28
void Add(const TFlt &Val, const TFlt &Wgt=1)
Definition: xmath.h:217
bool HasVal(const TGStatVal &StatVal) const
Definition: gstat.cpp:75
void SetVal(const TGStatVal &StatVal, const double &Val)
Definition: gstat.cpp:88
double GetMean() const
Definition: xmath.h:240
Definition: hash.h:97
void GetKeyDatPrV(TVec< TPair< TKey, TDat > > &KeyDatPrV) const
Definition: hash.h:500
double GetVal(const TGStatVal &StatVal) const
Definition: gstat.cpp:81
Definition: gstat.h:23
void SetDistr(const TGStatDistr &Distr, const TFltPrV &FltPrV)
Definition: gstat.cpp:97
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
void Def()
Definition: xmath.cpp:339
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
Definition: gstat.h:31

Here is the call graph for this function:

TFSet TGStat::BasicStat ( )
static

Definition at line 380 of file gstat.cpp.

380  {
381  return TFSet();
382 }
Definition: bits.h:119
PGStat TGStat::Clone ( ) const
inline

Definition at line 80 of file gstat.h.

References TGStat().

80 { return new TGStat(*this); }
TGStat(const TSecTm &GraphTm=TSecTm(), const TStr &GraphName=TStr())
Definition: gstat.cpp:21

Here is the call graph for this function:

TFSet TGStat::DegDStat ( )
static

Definition at line 384 of file gstat.cpp.

References gsdInDeg, and gsdOutDeg.

384  {
385  return TFSet() | gsdInDeg | gsdOutDeg;
386 }
Definition: gstat.h:28
Definition: bits.h:119
void TGStat::DumpValStat ( )

Definition at line 235 of file gstat.cpp.

References GetVal(), GetValStr(), gsvMx, gsvNone, and HasVal().

235  {
236  for (int val = gsvNone; val < gsvMx; val++) {
237  const TGStatVal Val = TGStatVal(val);
238  if (! HasVal(Val)) { continue; }
239  printf(" %s\t%g\n", GetValStr(Val).CStr(), GetVal(Val));
240  }
241 }
static TStr GetValStr(const TGStatVal &Val)
Definition: gstat.cpp:307
enum TGStatVal_ TGStatVal
Definition: gstat.h:16
bool HasVal(const TGStatVal &StatVal) const
Definition: gstat.cpp:75
double GetVal(const TGStatVal &StatVal) const
Definition: gstat.cpp:81
Definition: gstat.h:23

Here is the call graph for this function:

int TGStat::GetDay ( ) const
inline

Definition at line 87 of file gstat.h.

References TSecTm::GetDayN().

87 { return Time.GetDayN(); }
TSecTm Time
Definition: gstat.h:55
int GetDayN() const
Definition: tm.cpp:578

Here is the call graph for this function:

const TFltPrV & TGStat::GetDistr ( const TGStatDistr Distr) const

Definition at line 92 of file gstat.cpp.

References DistrStatH, and EmptyV.

Referenced by GetDistr(), and Plot().

92  {
93  if (! DistrStatH.IsKey(int(Distr))) { return EmptyV; }
94  return DistrStatH.GetDat(int(Distr));
95 }
static const TFltPrV EmptyV
Definition: gstat.h:52
THash< TInt, TFltPrV > DistrStatH
Definition: gstat.h:58

Here is the caller graph for this function:

void TGStat::GetDistr ( const TGStatDistr Distr,
TFltPrV FltPrV 
) const

Definition at line 101 of file gstat.cpp.

References GetDistr().

101  {
102  FltPrV = GetDistr(Distr);
103 }
const TFltPrV & GetDistr(const TGStatDistr &Distr) const
Definition: gstat.cpp:92

Here is the call graph for this function:

int TGStat::GetDistrs ( ) const
inline

Definition at line 101 of file gstat.h.

References DistrStatH.

101 { return DistrStatH.Len(); }
THash< TInt, TFltPrV > DistrStatH
Definition: gstat.h:58
TStr TGStat::GetDistrStr ( const TGStatDistr Distr)
static

Definition at line 289 of file gstat.cpp.

References Fail, gsdClustCf, gsdHops, gsdInDeg, gsdMx, gsdOutDeg, gsdScc, gsdSngVal, gsdSngVec, gsdTriadPart, gsdUndef, gsdWcc, and gsdWccHops.

289  {
290  switch (Distr) {
291  case gsdUndef : return TStr("Undef");
292  case gsdInDeg : return "InDeg";
293  case gsdOutDeg : return "OutDeg";
294  case gsdWcc : return "WccDist";
295  case gsdScc : return "SccDist";
296  case gsdHops : return "Hops";
297  case gsdWccHops : return "WccHops";
298  case gsdSngVal : return "SngVal";
299  case gsdSngVec : return "SngVec";
300  case gsdClustCf : return "ClustCf";
301  case gsdTriadPart : return "TriadPart";
302  case gsdMx: return TStr("Mx");
303  default: Fail; return TStr();
304  };
305 }
#define Fail
Definition: bd.h:238
Definition: gstat.h:28
Definition: gstat.h:29
Definition: gstat.h:28
Definition: gstat.h:28
Definition: gstat.h:28
Definition: dt.h:412
Definition: gstat.h:31
int TGStat::GetEdges ( ) const
inline

Definition at line 108 of file gstat.h.

References GetVal(), and gsvEdges.

Referenced by Plot().

108 { return (int) GetVal(gsvEdges); }
Definition: gstat.h:17
double GetVal(const TGStatVal &StatVal) const
Definition: gstat.cpp:81

Here is the call graph for this function:

Here is the caller graph for this function:

int TGStat::GetHour ( ) const
inline

Definition at line 88 of file gstat.h.

References TSecTm::GetHourN().

88 { return Time.GetHourN(); }
TSecTm Time
Definition: gstat.h:55
int GetHourN() const
Definition: tm.cpp:596

Here is the call graph for this function:

int TGStat::GetMin ( ) const
inline

Definition at line 89 of file gstat.h.

References TSecTm::GetMinN().

89 { return Time.GetMinN(); }
int GetMinN() const
Definition: tm.cpp:602
TSecTm Time
Definition: gstat.h:55

Here is the call graph for this function:

int TGStat::GetMonth ( ) const
inline

Definition at line 86 of file gstat.h.

References TSecTm::GetMonthN().

86 { return Time.GetMonthN(); }
TSecTm Time
Definition: gstat.h:55
int GetMonthN() const
Definition: tm.cpp:566

Here is the call graph for this function:

TStr TGStat::GetNm ( ) const
inline

Definition at line 93 of file gstat.h.

References GraphNm.

93 { return GraphNm; }
TStr GraphNm
Definition: gstat.h:56
int TGStat::GetNodes ( ) const
inline

Definition at line 107 of file gstat.h.

References GetVal(), and gsvNodes.

Referenced by Plot().

107 { return (int) GetVal(gsvNodes); }
double GetVal(const TGStatVal &StatVal) const
Definition: gstat.cpp:81
Definition: gstat.h:16

Here is the call graph for this function:

Here is the caller graph for this function:

TGStat::TPlotInfo TGStat::GetPlotInfo ( const TGStatVal Val)
static

Definition at line 351 of file gstat.cpp.

References Fail.

Referenced by Plot().

351  {
352  //switch (Distr) {
353  //case gsdUndef : Fail; return TPlotInfo();
354  Fail;
355  return TPlotInfo();
356 }
#define Fail
Definition: bd.h:238
TQuad< TStr, TStr, TStr, TGpScaleTy > TPlotInfo
Definition: gstat.h:40

Here is the caller graph for this function:

TGStat::TPlotInfo TGStat::GetPlotInfo ( const TGStatDistr Distr)
static

Definition at line 358 of file gstat.cpp.

References Fail, gpsLog10XY, gpsLog10Y, gsdClustCf, gsdHops, gsdInDeg, gsdMx, gsdOutDeg, gsdScc, gsdSngVal, gsdSngVec, gsdTriadPart, gsdUndef, gsdWcc, and gsdWccHops.

358  {
359  switch (Distr) {
360  case gsdUndef : Fail; return TPlotInfo();
361  case gsdInDeg : return TPlotInfo("inDeg", "In-degree, k", "Count", gpsLog10XY);
362  case gsdOutDeg : return TPlotInfo("outDeg", "Out-degree, k", "Count", gpsLog10XY);
363  case gsdWcc : return TPlotInfo("wcc", "WCC size", "Count", gpsLog10XY);
364  case gsdScc : return TPlotInfo("scc", "SCC size", "Count", gpsLog10XY);
365  case gsdHops : return TPlotInfo("hop", "Number of hops, h", "Reachable pairs of nodes inside h hops", gpsLog10Y);
366  case gsdWccHops : return TPlotInfo("wccHop", "Number of hops, h", "Reachable pairs of nodes inside h hops in WCC", gpsLog10Y);
367  case gsdSngVal : return TPlotInfo("sval", "Rank", "Singular value", gpsLog10XY);
368  case gsdSngVec : return TPlotInfo("svec", "Rank", "Left singular vector", gpsLog10XY);
369  case gsdClustCf : return TPlotInfo("ccf", "Degree, k", "Clustering coefficient, <C(k)>", gpsLog10XY);
370  case gsdTriadPart : return TPlotInfo("triad", "Number of triads adjacent to a node", "Number of such nodes", gpsLog10XY);
371  case gsdMx : Fail;
372  default: Fail; return TPlotInfo();
373  };
374 }
#define Fail
Definition: bd.h:238
Definition: gstat.h:28
Definition: gstat.h:29
Definition: gstat.h:28
Definition: gstat.h:28
Definition: gstat.h:28
TQuad< TStr, TStr, TStr, TGpScaleTy > TPlotInfo
Definition: gstat.h:40
Definition: gstat.h:31
int TGStat::GetSec ( ) const
inline

Definition at line 90 of file gstat.h.

References TSecTm::GetSecN().

90 { return Time.GetSecN(); }
TSecTm Time
Definition: gstat.h:55
int GetSecN() const
Definition: tm.cpp:608

Here is the call graph for this function:

int TGStat::GetTime ( const TTmUnit TimeUnit) const
inline

Definition at line 95 of file gstat.h.

References TSecTm::GetInUnits().

95 { return Time.GetInUnits(TimeUnit); }
uint GetInUnits(const TTmUnit &TmUnit) const
Definition: tm.cpp:650
TSecTm Time
Definition: gstat.h:55

Here is the call graph for this function:

TStr TGStat::GetTmStr ( ) const
inline

Definition at line 91 of file gstat.h.

References TSecTm::GetStr().

Referenced by TGStatVec::SaveTxt().

91 { return Time.GetStr(); }
TSecTm Time
Definition: gstat.h:55
TStr GetStr(const TLoc &Loc=lUs) const
Definition: tm.cpp:457

Here is the call graph for this function:

Here is the caller graph for this function:

double TGStat::GetVal ( const TGStatVal StatVal) const

Definition at line 81 of file gstat.cpp.

References TSecTm::GetAbsSecs(), THash< TKey, TDat, THashFunc >::GetDat(), gsvIndex, gsvTime, THash< TKey, TDat, THashFunc >::IsKey(), Time, and ValStatH.

Referenced by AvgGStat(), DumpValStat(), GetEdges(), GetNodes(), TGStat::TCmpByVal::operator()(), TGStatVec::SaveTxt(), and TakeBasicStat().

81  {
82  if (StatVal == gsvIndex) { return -1; }
83  if (StatVal == gsvTime) { return Time.GetAbsSecs(); }
84  if (! ValStatH.IsKey(int(StatVal))) { return -1.0; }
85  return ValStatH.GetDat(int(StatVal));
86 }
TSecTm Time
Definition: gstat.h:55
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
Definition: gstat.h:16
TIntFltH ValStatH
Definition: gstat.h:57
uint GetAbsSecs() const
Definition: tm.h:150
Definition: gstat.h:16
bool IsKey(const TKey &Key) const
Definition: hash.h:258

Here is the call graph for this function:

Here is the caller graph for this function:

int TGStat::GetVals ( ) const
inline

Definition at line 97 of file gstat.h.

References THash< TKey, TDat, THashFunc >::Len(), and ValStatH.

97 { return ValStatH.Len(); }
TIntFltH ValStatH
Definition: gstat.h:57
int Len() const
Definition: hash.h:228

Here is the call graph for this function:

TStr TGStat::GetValStr ( const TGStatVal Val)
static

Definition at line 307 of file gstat.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), THash< TKey, TDat, THashFunc >::Empty(), THash< TKey, TDat, THashFunc >::GetDat(), gsvBccEdges, gsvBccNodes, gsvBccSize, gsvBiDirEdges, gsvClosedTriads, gsvClustCf, gsvDstNodes, gsvEdges, gsvEffDiam, gsvEffDiamDev, gsvEffWccDiam, gsvEffWccDiamDev, gsvFullDiam, gsvFullDiamDev, gsvFullWccDiam, gsvFullWccDiamDev, gsvIndex, gsvMx, gsvNodes, gsvNone, gsvNonZNodes, gsvOpenTriads, gsvSccEdges, gsvSccNodes, gsvSccSize, gsvSrcNodes, gsvTime, gsvUniqEdges, gsvWccBiDirEdges, gsvWccDstNodes, gsvWccEdges, gsvWccNodes, gsvWccSize, gsvWccSrcNodes, gsvWccUniqEdges, gsvZeroNodes, IAssert, and THash< TKey, TDat, THashFunc >::IsKey().

Referenced by DumpValStat(), TGStat::TCmpByVal::operator()(), TGStatVec::Plot(), and TGStatVec::SaveTxt().

307  {
308  static TIntStrH ValTyStrH;
309  if (ValTyStrH.Empty()) {
310  ValTyStrH.AddDat(gsvNone, "None");
311  ValTyStrH.AddDat(gsvIndex, "Index");
312  ValTyStrH.AddDat(gsvTime, "Time");
313  ValTyStrH.AddDat(gsvNodes, "Nodes");
314  ValTyStrH.AddDat(gsvZeroNodes, "ZeroNodes");
315  ValTyStrH.AddDat(gsvNonZNodes, "NonZNodes");
316  ValTyStrH.AddDat(gsvSrcNodes, "SrcNodes");
317  ValTyStrH.AddDat(gsvDstNodes, "DstNodes");
318  ValTyStrH.AddDat(gsvEdges, "Edges");
319  ValTyStrH.AddDat(gsvUniqEdges, "UniqEdges");
320  ValTyStrH.AddDat(gsvBiDirEdges, "BiDirEdges");
321  ValTyStrH.AddDat(gsvWccNodes, "WccNodes");
322  ValTyStrH.AddDat(gsvWccSrcNodes, "WccSrcNodes");
323  ValTyStrH.AddDat(gsvWccDstNodes, "WccDstNodes");
324  ValTyStrH.AddDat(gsvWccEdges, "WccEdges");
325  ValTyStrH.AddDat(gsvWccUniqEdges, "WccUniqEdges");
326  ValTyStrH.AddDat(gsvWccBiDirEdges, "WccBiDirEdges");
327  ValTyStrH.AddDat(gsvSccNodes, "SccNodes");
328  ValTyStrH.AddDat(gsvSccEdges, "SccEdges");
329  ValTyStrH.AddDat(gsvBccNodes, "BccNodes");
330  ValTyStrH.AddDat(gsvBccEdges, "BccEdges");
331  ValTyStrH.AddDat(gsvFullDiam, "FullDiam");
332  ValTyStrH.AddDat(gsvEffDiam, "EffDiam");
333  ValTyStrH.AddDat(gsvEffWccDiam, "EffWccDiam");
334  ValTyStrH.AddDat(gsvFullWccDiam, "FullWccDiam");
335  ValTyStrH.AddDat(gsvFullDiamDev, "FullDiamDev");
336  ValTyStrH.AddDat(gsvEffDiamDev, "EffDiamDev");
337  ValTyStrH.AddDat(gsvEffWccDiamDev, "EffWccDiamDev");
338  ValTyStrH.AddDat(gsvFullWccDiamDev, "FullWccDiamDev");
339  ValTyStrH.AddDat(gsvClustCf, "ClustCf");
340  ValTyStrH.AddDat(gsvOpenTriads, "OpenTr");
341  ValTyStrH.AddDat(gsvClosedTriads, "ClosedTr");
342  ValTyStrH.AddDat(gsvWccSize, "WccSize");
343  ValTyStrH.AddDat(gsvSccSize, "SccSize");
344  ValTyStrH.AddDat(gsvBccSize, "BccSize");
345  ValTyStrH.AddDat(gsvMx, "Mx");
346  }
347  IAssert(ValTyStrH.IsKey(int(Val)));
348  return ValTyStrH.GetDat(int(Val));
349 }
#define IAssert(Cond)
Definition: bd.h:262
bool Empty() const
Definition: hash.h:227
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
Definition: gstat.h:16
Definition: gstat.h:16
Definition: gstat.h:17
Definition: gstat.h:16
Definition: gstat.h:23
Definition: gstat.h:16
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TDat & AddDat(const TKey &Key)
Definition: hash.h:238

Here is the call graph for this function:

Here is the caller graph for this function:

int TGStat::GetYear ( ) const
inline

Definition at line 85 of file gstat.h.

References TSecTm::GetYearN().

85 { return Time.GetYearN(); }
int GetYearN() const
Definition: tm.cpp:560
TSecTm Time
Definition: gstat.h:55

Here is the call graph for this function:

bool TGStat::HasDistr ( const TGStatDistr Distr) const
inline

Definition at line 102 of file gstat.h.

References DistrStatH.

Referenced by AvgGStat(), and Plot().

102 { return DistrStatH.IsKey(Distr); }
THash< TInt, TFltPrV > DistrStatH
Definition: gstat.h:58

Here is the caller graph for this function:

bool TGStat::HasVal ( const TGStatVal StatVal) const

Definition at line 75 of file gstat.cpp.

References gsvIndex, gsvTime, TSecTm::IsDef(), THash< TKey, TDat, THashFunc >::IsKey(), Time, and ValStatH.

Referenced by AvgGStat(), DumpValStat(), and TGStat::TCmpByVal::operator()().

75  {
76  if (StatVal == gsvIndex) { return true; }
77  if (StatVal == gsvTime) { return Time.IsDef(); }
78  return ValStatH.IsKey(int(StatVal));
79 }
bool IsDef() const
Definition: tm.h:123
TSecTm Time
Definition: gstat.h:55
Definition: gstat.h:16
TIntFltH ValStatH
Definition: gstat.h:57
Definition: gstat.h:16
bool IsKey(const TKey &Key) const
Definition: hash.h:258

Here is the call graph for this function:

Here is the caller graph for this function:

static PGStat TGStat::Load ( TSIn SIn)
inlinestatic

Definition at line 79 of file gstat.h.

References TGStat().

79 { return new TGStat(SIn); }
TGStat(const TSecTm &GraphTm=TSecTm(), const TStr &GraphName=TStr())
Definition: gstat.cpp:21

Here is the call graph for this function:

static PGStat TGStat::New ( const TSecTm Time = TSecTm(),
const TStr GraphName = TStr() 
)
inlinestatic

Definition at line 69 of file gstat.h.

References TGStat().

Referenced by TGStatVec::Add(), and TGStatVec::GetAvgGStat().

69  {
70  return new TGStat(Time, GraphName); }
TGStat(const TSecTm &GraphTm=TSecTm(), const TStr &GraphName=TStr())
Definition: gstat.cpp:21

Here is the call graph for this function:

Here is the caller graph for this function:

static PGStat TGStat::New ( const PNGraph Graph,
const TSecTm Time,
TFSet  StatFSet = TFSet(),
const TStr GraphNm = TStr() 
)
inlinestatic

Definition at line 71 of file gstat.h.

References GraphNm, and TGStat().

72  { return new TGStat(Graph, Time, StatFSet, GraphNm); }
TGStat(const TSecTm &GraphTm=TSecTm(), const TStr &GraphName=TStr())
Definition: gstat.cpp:21

Here is the call graph for this function:

static PGStat TGStat::New ( const PUNGraph Graph,
const TSecTm Time,
TFSet  StatFSet = TFSet(),
const TStr GraphNm = TStr() 
)
inlinestatic

Definition at line 73 of file gstat.h.

References GraphNm, and TGStat().

74  { return new TGStat(Graph, Time, StatFSet, GraphNm); }
TGStat(const TSecTm &GraphTm=TSecTm(), const TStr &GraphName=TStr())
Definition: gstat.cpp:21

Here is the call graph for this function:

static PGStat TGStat::New ( const PNEGraph Graph,
const TSecTm Time,
TFSet  StatFSet = TFSet(),
const TStr GraphNm = TStr() 
)
inlinestatic

Definition at line 75 of file gstat.h.

References GraphNm, and TGStat().

76  { return new TGStat(Graph, Time, StatFSet, GraphNm); }
TGStat(const TSecTm &GraphTm=TSecTm(), const TStr &GraphName=TStr())
Definition: gstat.cpp:21

Here is the call graph for this function:

template<class PGraph >
PGStat TGStat::New ( const PGraph &  Graph,
const TSecTm Time,
TFSet  StatFSet = TFSet(),
const TStr GraphNm = TStr() 
)
inline

Definition at line 77 of file gstat.h.

References GraphNm, and TGStat().

78  { return new TGStat(Graph, Time, StatFSet, GraphNm); }
TGStat(const TSecTm &GraphTm=TSecTm(), const TStr &GraphName=TStr())
Definition: gstat.cpp:21

Here is the call graph for this function:

TFSet TGStat::NoDiamStat ( )
static

Definition at line 388 of file gstat.cpp.

References gsdInDeg, gsdOutDeg, gsdScc, and gsdWcc.

388  {
389  return TFSet() | gsdInDeg | gsdOutDeg | gsdWcc | gsdScc;
390 }
Definition: gstat.h:28
Definition: bits.h:119
Definition: gstat.h:28
Definition: gstat.h:28
TFSet TGStat::NoDistrStat ( )
static

Definition at line 392 of file gstat.cpp.

References gsdHops, and gsdWccHops.

392  {
393  return TFSet() | gsdHops | gsdWccHops;
394 }
Definition: bits.h:119
Definition: gstat.h:29
TFSet TGStat::NoStat ( )
static

Definition at line 376 of file gstat.cpp.

References gsvNone.

376  {
377  return TFSet() | gsvNone;
378 }
Definition: bits.h:119
Definition: gstat.h:16
TFSet TGStat::NoSvdStat ( )
static

Definition at line 396 of file gstat.cpp.

References gsdClustCf, gsdHops, gsdInDeg, gsdOutDeg, gsdScc, gsdTriadPart, gsdWcc, and gsdWccHops.

396  {
397  return TFSet() | gsdInDeg | gsdOutDeg | gsdWcc | gsdScc |
399 }
Definition: gstat.h:28
Definition: bits.h:119
Definition: gstat.h:29
Definition: gstat.h:28
Definition: gstat.h:28
bool TGStat::operator< ( const TGStat GStat) const

Definition at line 61 of file gstat.cpp.

References THash< TKey, TDat, THashFunc >::Empty(), THash< TKey, TDat, THashFunc >::GetDat(), gsvMx, gsvTime, THash< TKey, TDat, THashFunc >::IsKey(), Time, and ValStatH.

61  {
62  if (Time<GStat.Time) { return true; }
63  if (Time>GStat.Time) { return false; }
64  if (ValStatH.Empty() && ! GStat.ValStatH.Empty()) { return true; }
65  if (GStat.ValStatH.Empty()) { return false; }
66  for (int v = gsvTime; v < gsvMx; v++) {
67  if (! ValStatH.IsKey(v) && ! GStat.ValStatH.IsKey(v)) { continue; }
68  if (ValStatH.IsKey(v) && ! GStat.ValStatH.IsKey(v)) { return false; }
69  if (! ValStatH.IsKey(v)) { return true; }
70  if (ValStatH.GetDat(v) < GStat.ValStatH.GetDat(v)) { return true; }
71  }
72  return false;
73 }
bool Empty() const
Definition: hash.h:227
TSecTm Time
Definition: gstat.h:55
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
Definition: gstat.h:16
TIntFltH ValStatH
Definition: gstat.h:57
Definition: gstat.h:23
bool IsKey(const TKey &Key) const
Definition: hash.h:258

Here is the call graph for this function:

TGStat & TGStat::operator= ( const TGStat GStat)

Definition at line 47 of file gstat.cpp.

References DistrStatH, GraphNm, Time, and ValStatH.

47  {
48  if (this != &GStat) {
49  Time = GStat.Time;
50  GraphNm = GStat.GraphNm;
51  ValStatH = GStat.ValStatH;
52  DistrStatH = GStat.DistrStatH;
53  }
54  return *this;
55 }
TStr GraphNm
Definition: gstat.h:56
TSecTm Time
Definition: gstat.h:55
THash< TInt, TFltPrV > DistrStatH
Definition: gstat.h:58
TIntFltH ValStatH
Definition: gstat.h:57
bool TGStat::operator== ( const TGStat GStat) const

Definition at line 57 of file gstat.cpp.

References DistrStatH, Time, and ValStatH.

57  {
58  return Time==GStat.Time && ValStatH==GStat.ValStatH && DistrStatH==GStat.DistrStatH;
59 }
TSecTm Time
Definition: gstat.h:55
THash< TInt, TFltPrV > DistrStatH
Definition: gstat.h:58
TIntFltH ValStatH
Definition: gstat.h:57
void TGStat::Plot ( const TGStatDistr Distr,
const TStr FNmPref,
TStr  Desc = TStr(),
bool  PowerFit = false 
) const

Definition at line 204 of file gstat.cpp.

References TGnuPlot::AddPlot(), TGnuPlot::AddPwrFit(), TStr::CStr(), TStr::Empty(), TStr::Fmt(), GetDistr(), GetEdges(), GetNodes(), GetPlotInfo(), TStr::GetUc(), gpwLines, gpwLinesPoints, gsdMx, gsdUndef, HasDistr(), TGnuPlot::SaveEps(), TGnuPlot::SavePng(), TGnuPlot::SetScale(), TGnuPlot::SetXYLabel(), TQuad< TVal1, TVal2, TVal3, TVal4 >::Val1, TQuad< TVal1, TVal2, TVal3, TVal4 >::Val2, TQuad< TVal1, TVal2, TVal3, TVal4 >::Val3, and TQuad< TVal1, TVal2, TVal3, TVal4 >::Val4.

Referenced by Plot(), and PlotAll().

204  {
205  if (Desc.Empty()) Desc = FNmPref.GetUc();
206  if (! HasDistr(Distr) || Distr==gsdUndef || Distr==gsdMx) { return; }
207  TPlotInfo Info = GetPlotInfo(Distr);
208  TGnuPlot GnuPlot(Info.Val1+TStr(".")+FNmPref, TStr::Fmt("%s. G(%d, %d)", Desc.CStr(), GetNodes(),GetEdges()));
209  GnuPlot.SetXYLabel(Info.Val2, Info.Val3);
210  GnuPlot.SetScale(Info.Val4);
211  const int plotId = GnuPlot.AddPlot(GetDistr(Distr), gpwLinesPoints, "");
212  if (PowerFit) { GnuPlot.AddPwrFit(plotId, gpwLines); }
213  #ifdef GLib_MACOSX
214  GnuPlot.SaveEps();
215  #else
216  GnuPlot.SavePng();
217  #endif
218 }
TStr GetUc() const
Definition: dt.h:493
bool HasDistr(const TGStatDistr &Distr) const
Definition: gstat.h:102
int GetNodes() const
Definition: gstat.h:107
static TPlotInfo GetPlotInfo(const TGStatVal &Val)
Definition: gstat.cpp:351
Definition: gstat.h:28
int GetEdges() const
Definition: gstat.h:108
Definition: dt.h:412
bool Empty() const
Definition: dt.h:488
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
TQuad< TStr, TStr, TStr, TGpScaleTy > TPlotInfo
Definition: gstat.h:40
char * CStr()
Definition: dt.h:476
const TFltPrV & GetDistr(const TGStatDistr &Distr) const
Definition: gstat.cpp:92
Definition: gstat.h:31

Here is the call graph for this function:

Here is the caller graph for this function:

void TGStat::Plot ( const TFSet FSet,
const TStr FNmPref,
const TStr Desc = TStr(),
bool  PowerFit = false 
) const

Definition at line 220 of file gstat.cpp.

References gsdMx, gsdUndef, TFSet::In(), and Plot().

220  {
221  for (int d = gsdUndef; d < gsdMx; d++) {
222  const TGStatDistr Distr = TGStatDistr(d);
223  if (! FSet.In(Distr)) { continue; }
224  Plot(Distr, FNmPref, Desc, PowerFit);
225  }
226 }
enum TGStatDistr_ TGStatDistr
Definition: gstat.h:28
void Plot(const TGStatDistr &Distr, const TStr &FNmPref, TStr Desc=TStr(), bool PowerFit=false) const
Definition: gstat.cpp:204
Definition: gstat.h:31
bool In(const int &FlagN) const
Definition: bits.h:156

Here is the call graph for this function:

void TGStat::PlotAll ( const TStr FNmPref,
TStr  Desc = TStr(),
bool  PowerFit = false 
) const

Definition at line 228 of file gstat.cpp.

References gsdMx, gsdUndef, and Plot().

228  {
229  for (int d = gsdUndef; d < gsdMx; d++) {
230  const TGStatDistr Distr = TGStatDistr(d);
231  Plot(Distr, FNmPref, Desc, PowerFit);
232  }
233 }
enum TGStatDistr_ TGStatDistr
Definition: gstat.h:28
void Plot(const TGStatDistr &Distr, const TStr &FNmPref, TStr Desc=TStr(), bool PowerFit=false) const
Definition: gstat.cpp:204
Definition: gstat.h:31

Here is the call graph for this function:

void TGStat::Save ( TSOut SOut) const

Definition at line 42 of file gstat.cpp.

References DistrStatH, GraphNm, TSecTm::Save(), THash< TKey, TDat, THashFunc >::Save(), TStr::Save(), Time, and ValStatH.

42  {
43  Time.Save(SOut); GraphNm.Save(SOut);
44  ValStatH.Save(SOut); DistrStatH.Save(SOut);
45 }
TStr GraphNm
Definition: gstat.h:56
void Save(TSOut &SOut) const
Definition: hash.h:183
TSecTm Time
Definition: gstat.h:55
void Save(TSOut &SOut) const
Definition: tm.h:103
THash< TInt, TFltPrV > DistrStatH
Definition: gstat.h:58
void Save(TSOut &SOut, const bool &IsSmall=false) const
Definition: dt.h:440
TIntFltH ValStatH
Definition: gstat.h:57

Here is the call graph for this function:

void TGStat::SetDistr ( const TGStatDistr Distr,
const TFltPrV FltPrV 
)

Definition at line 97 of file gstat.cpp.

References DistrStatH.

Referenced by AvgGStat().

97  {
98  DistrStatH.AddDat(Distr, FltPrV);
99 }
THash< TInt, TFltPrV > DistrStatH
Definition: gstat.h:58

Here is the caller graph for this function:

void TGStat::SetNm ( const TStr GraphName)
inline

Definition at line 94 of file gstat.h.

References GraphNm.

94 { GraphNm=GraphName; }
TStr GraphNm
Definition: gstat.h:56
void TGStat::SetTm ( const TSecTm GraphTm)
inline

Definition at line 92 of file gstat.h.

92 { Time = GraphTm; }
TSecTm Time
Definition: gstat.h:55
void TGStat::SetVal ( const TGStatVal StatVal,
const double &  Val 
)

Definition at line 88 of file gstat.cpp.

References THash< TKey, TDat, THashFunc >::AddDat(), and ValStatH.

Referenced by AvgGStat(), TTimeNet::PlotMissingPast(), TakeBasicStat(), TakeBccStat(), TakeClustCf(), TakeDiam(), TakeSccStat(), and TakeStat().

88  {
89  ValStatH.AddDat(int(StatVal), Val);
90 }
TIntFltH ValStatH
Definition: gstat.h:57
TDat & AddDat(const TKey &Key)
Definition: hash.h:238

Here is the call graph for this function:

Here is the caller graph for this function:

template<class PGraph >
void TGStat::TakeBasicStat ( const PGraph &  Graph,
const bool &  IsMxWcc = false 
)

Definition at line 257 of file gstat.h.

References gsvBiDirEdges, and gsvWccBiDirEdges.

Referenced by TTimeNet::PlotMissingPast(), and TakeStat().

257  {
258  TakeBasicStat(Graph, TFSet() | gsvBiDirEdges | gsvWccBiDirEdges, IsMxWcc);
259 }
Definition: bits.h:119
void TakeBasicStat(const PGraph &Graph, const bool &IsMxWcc=false)
Definition: gstat.h:257

Here is the caller graph for this function:

template<class PGraph >
void TGStat::TakeBasicStat ( const PGraph &  Graph,
TFSet  FSet,
const bool &  IsMxWcc = false 
)

Definition at line 262 of file gstat.h.

References TSnap::CntDegNodes(), TSnap::CntInDegNodes(), TSnap::CntOutDegNodes(), TSnap::CntUniqBiDirEdges(), TSnap::CntUniqDirEdges(), TExeTm::GetTmStr(), GetVal(), gfDirected, gfMultiGraph, gsvBiDirEdges, gsvDstNodes, gsvEdges, gsvNodes, gsvNonZNodes, gsvSrcNodes, gsvUniqEdges, gsvWccBiDirEdges, gsvWccDstNodes, gsvWccEdges, gsvWccNodes, gsvWccSrcNodes, gsvWccUniqEdges, gsvZeroNodes, TFSet::In(), and SetVal().

262  {
263  TExeTm ExeTm;
264  if (! IsMxWcc) {
265  // gsvNodes, gsvZeroNodes, gsvNonZNodes, gsvSrcNodes, gsvDstNodes,
266  // gsvEdges, gsvUniqEdges, gsvBiDirEdges
267  printf("basic...");
268  const int Nodes = Graph->GetNodes();
269  SetVal(gsvNodes, Nodes);
272  SetVal(gsvSrcNodes, Nodes - TSnap::CntOutDegNodes(Graph, 0));
273  SetVal(gsvDstNodes, Nodes - TSnap::CntInDegNodes(Graph, 0));
274  SetVal(gsvEdges, Graph->GetEdges());
275  if (! Graph->HasFlag(gfMultiGraph)) { SetVal(gsvUniqEdges, Graph->GetEdges()); }
276  else { SetVal(gsvUniqEdges, TSnap::CntUniqDirEdges(Graph)); }
277  if (FSet.In(gsvBiDirEdges)) {
278  if (Graph->HasFlag(gfDirected)) { SetVal(gsvBiDirEdges, TSnap::CntUniqBiDirEdges(Graph)); }
279  else { SetVal(gsvUniqEdges, GetVal(gsvEdges)); }
280  }
281  printf("[%s] ", ExeTm.GetTmStr());
282  } else {
283  // gsvWccNodes, gsvWccSrcNodes, gsvWccDstNodes, gsvWccEdges, gsvWccUniqEdges, gsvWccBiDirEdges
284  printf("basic wcc...");
285  const int Nodes = Graph->GetNodes();
286  SetVal(gsvWccNodes, Nodes);
287  SetVal(gsvWccSrcNodes, Nodes - TSnap::CntOutDegNodes(Graph, 0));
288  SetVal(gsvWccDstNodes, Nodes - TSnap::CntInDegNodes(Graph, 0));
289  SetVal(gsvWccEdges, Graph->GetEdges());
290  if (! Graph->HasFlag(gfMultiGraph)) { SetVal(gsvWccUniqEdges, Graph->GetEdges()); }
292  if (FSet.In(gsvBiDirEdges)) {
293  if (Graph->HasFlag(gfDirected)) { SetVal(gsvWccBiDirEdges, TSnap::CntUniqBiDirEdges(Graph)); }
294  else { SetVal(gsvUniqEdges, GetVal(gsvEdges)); }
295  }
296  printf("[%s] ", ExeTm.GetTmStr());
297  }
298 }
Definition: tm.h:355
int CntUniqDirEdges(const PGraph &Graph)
Counts unique directed edges in the graph Graph. Nodes (u,v) (where u!=v) are connected via a directe...
Definition: alg.h:301
have explicit edges (multigraph): TNEGraph, TNodeEdgeNet
Definition: gbase.h:14
const char * GetTmStr() const
Definition: tm.h:370
Definition: gstat.h:17
int CntUniqBiDirEdges(const PGraph &Graph)
Counts unique bidirectional edges in the graph Graph. Edge is bidirectional if there exist directed e...
Definition: alg.h:316
void SetVal(const TGStatVal &StatVal, const double &Val)
Definition: gstat.cpp:88
int CntInDegNodes(const PGraph &Graph, const int &NodeInDeg)
Returns the number of nodes with in-degree NodeInDeg.
Definition: alg.h:87
directed graph (TNGraph, TNEGraph), else graph is undirected TUNGraph
Definition: gbase.h:13
double GetVal(const TGStatVal &StatVal) const
Definition: gstat.cpp:81
Definition: gstat.h:16
int CntDegNodes(const PGraph &Graph, const int &NodeDeg)
Returns the number of nodes with degree NodeDeg.
Definition: alg.h:105
int CntOutDegNodes(const PGraph &Graph, const int &NodeOutDeg)
Returns the number of nodes with out-degree NodeOutDeg.
Definition: alg.h:96
bool In(const int &FlagN) const
Definition: bits.h:156

Here is the call graph for this function:

template<class PGraph >
void TGStat::TakeBccStat ( const PGraph &  Graph,
TFSet  StatFSet 
)

Definition at line 434 of file gstat.h.

References TSnap::GetMxBiCon(), TExeTm::GetTmStr(), gsvBccEdges, gsvBccNodes, gsvBccSize, TFSet::In(), and SetVal().

Referenced by TakeStat().

434  {
435  TExeTm ExeTm;
436  if (StatFSet.In(gsvBccNodes) || StatFSet.In(gsvBccEdges) || StatFSet.In(gsvBccSize)) {
437  printf("bcc...");
438  PGraph BccG = TSnap::GetMxBiCon(Graph);
439  SetVal(gsvBccNodes, BccG->GetNodes());
440  SetVal(gsvBccEdges, BccG->GetEdges());
441  SetVal(gsvBccSize, BccG->GetNodes()/double(Graph->GetNodes()));
442  printf("[%s] ", ExeTm.GetTmStr());
443  }
444 }
PUNGraph GetMxBiCon(const PUNGraph &Graph, const bool &RenumberNodes)
Returns a graph representing the largest bi-connected component on an undirected Graph.
Definition: cncom.cpp:126
Definition: tm.h:355
const char * GetTmStr() const
Definition: tm.h:370
void SetVal(const TGStatVal &StatVal, const double &Val)
Definition: gstat.cpp:88
bool In(const int &FlagN) const
Definition: bits.h:156

Here is the call graph for this function:

Here is the caller graph for this function:

template<class PGraph >
void TGStat::TakeClustCf ( const PGraph &  Graph,
const int &  SampleNodes = -1 
)

Definition at line 447 of file gstat.h.

References DistrStatH, TSnap::GetClustCf(), TExeTm::GetTmStr(), gsdClustCf, gsvClosedTriads, gsvClustCf, gsvOpenTriads, and SetVal().

Referenced by TakeStat().

447  {
448  TExeTm ExeTm;
449  printf("clustcf...");
450  TFltPrV& ClustCfV = DistrStatH.AddDat(gsdClustCf);
451  int64 Open, Close;
452  const double ClustCf = TSnap::GetClustCf(Graph, ClustCfV, Close, Open, SampleNodes);
453  SetVal(gsvClustCf, ClustCf);
454  SetVal(gsvOpenTriads, static_cast<double>(Open));
455  SetVal(gsvClosedTriads, static_cast<double>(Close));
456  printf("[%s] ", ExeTm.GetTmStr());
457 }
Definition: tm.h:355
const char * GetTmStr() const
Definition: tm.h:370
THash< TInt, TFltPrV > DistrStatH
Definition: gstat.h:58
void SetVal(const TGStatVal &StatVal, const double &Val)
Definition: gstat.cpp:88
long long int64
Definition: bd.h:27
double GetClustCf(const PGraph &Graph, int SampleNodes=-1)
Computes the average clustering coefficient as defined in Watts and Strogatz, Collective dynamics of ...
Definition: triad.h:113
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430

Here is the call graph for this function:

Here is the caller graph for this function:

template<class PGraph >
void TGStat::TakeConnComp ( const PGraph &  Graph)

Definition at line 392 of file gstat.h.

References gsdScc, and gsdWcc.

Referenced by TakeStat().

392  {
393  TakeConnComp(Graph, TFSet() | gsdWcc | gsdScc);
394 }
Definition: bits.h:119
void TakeConnComp(const PGraph &Graph)
Definition: gstat.h:392
Definition: gstat.h:28
Definition: gstat.h:28

Here is the caller graph for this function:

template<class PGraph >
void TGStat::TakeConnComp ( const PGraph &  Graph,
TFSet  StatFSet 
)

Definition at line 397 of file gstat.h.

References TVec< TVal, TSizeTy >::Add(), DistrStatH, TVec< TVal, TSizeTy >::Gen(), TSnap::GetSccSzCnt(), TExeTm::GetTmStr(), TSnap::GetWccSzCnt(), gsdScc, gsdWcc, TFSet::In(), and TVec< TVal, TSizeTy >::Len().

397  {
398  TExeTm ExeTm;
399  if (StatFSet.In(gsdWcc)) {
400  printf("wcc...");
401  TIntPrV WccSzCntV1;
402  TSnap::GetWccSzCnt(Graph, WccSzCntV1);
403  TFltPrV& WccSzCntV = DistrStatH.AddDat(gsdWcc);
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()));
407  }
408  if (StatFSet.In(gsdScc)) {
409  printf("scc...");
410  TIntPrV SccSzCntV1;
411  TSnap::GetSccSzCnt(Graph, SccSzCntV1);
412  TFltPrV& SccSzCntV = DistrStatH.AddDat(gsdScc);
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()));
416  }
417  if (StatFSet.In(gsdWcc) || StatFSet.In(gsdScc)) { printf("[%s] ", ExeTm.GetTmStr()); }
418 }
Definition: tm.h:355
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
void GetSccSzCnt(const PGraph &Graph, TIntPrV &SccSzCnt)
Returns a distribution of strongly connected component sizes.
Definition: cncom.h:420
Definition: gstat.h:28
const char * GetTmStr() const
Definition: tm.h:370
THash< TInt, TFltPrV > DistrStatH
Definition: gstat.h:58
Definition: ds.h:32
Definition: gstat.h:28
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
void GetWccSzCnt(const PGraph &Graph, TIntPrV &WccSzCnt)
Returns a distribution of weakly connected component sizes.
Definition: cncom.h:337
bool In(const int &FlagN) const
Definition: bits.h:156

Here is the call graph for this function:

template<class PGraph >
void TGStat::TakeDegDistr ( const PGraph &  Graph)

Definition at line 301 of file gstat.h.

References gsdInDeg, and gsdOutDeg.

Referenced by TakeStat().

301  {
302  TakeDegDistr(Graph, TFSet() | gsdInDeg | gsdOutDeg);
303 }
Definition: gstat.h:28
Definition: bits.h:119
void TakeDegDistr(const PGraph &Graph)
Definition: gstat.h:301

Here is the caller graph for this function:

template<class PGraph >
void TGStat::TakeDegDistr ( const PGraph &  Graph,
TFSet  StatFSet 
)

Definition at line 306 of file gstat.h.

References DistrStatH, TSnap::GetInDegCnt(), TSnap::GetOutDegCnt(), TExeTm::GetTmStr(), gsdInDeg, gsdOutDeg, and TFSet::In().

306  {
307  TExeTm ExeTm;
308  // degree distribution
309  if (StatFSet.In(gsdOutDeg) || StatFSet.In(gsdOutDeg)) {
310  printf("deg:"); }
311  if (StatFSet.In(gsdInDeg)) {
312  printf("-in");
313  TFltPrV& InDegV = DistrStatH.AddDat(gsdInDeg);
314  TSnap::GetInDegCnt(Graph, InDegV);
315  }
316  if (StatFSet.In(gsdOutDeg)) {
317  printf("-out");
318  TFltPrV& OutDegV = DistrStatH.AddDat(gsdOutDeg);
319  TSnap::GetOutDegCnt(Graph, OutDegV);
320  }
321  if (StatFSet.In(gsdOutDeg) || StatFSet.In(gsdOutDeg)) {
322  printf("[%s] ", ExeTm.GetTmStr()); }
323 }
Definition: tm.h:355
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) ...
Definition: alg.h:201
Definition: gstat.h:28
const char * GetTmStr() const
Definition: tm.h:370
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) ...
Definition: alg.h:179
THash< TInt, TFltPrV > DistrStatH
Definition: gstat.h:58
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
bool In(const int &FlagN) const
Definition: bits.h:156

Here is the call graph for this function:

template<class PGraph >
void TGStat::TakeDiam ( const PGraph &  Graph,
const bool &  IsMxWcc = false 
)

Definition at line 326 of file gstat.h.

References gsdHops, gsdWccHops, gsvEffDiam, gsvEffWccDiam, and gsvFullDiam.

Referenced by TakeStat().

326  {
327  TakeDiam(Graph, TFSet() | gsvFullDiam | gsvEffDiam | gsdHops |
328  gsvEffWccDiam| gsdWccHops, IsMxWcc);
329 }
Definition: bits.h:119
Definition: gstat.h:29
void TakeDiam(const PGraph &Graph, const bool &IsMxWcc=false)
Definition: gstat.h:326

Here is the caller graph for this function:

template<class PGraph >
void TGStat::TakeDiam ( const PGraph &  Graph,
TFSet  StatFSet,
const bool &  IsMxWcc = false 
)

Definition at line 332 of file gstat.h.

References TMom::Add(), TSnap::TSnapDetail::CalcEffDiam(), TMom::Def(), DistrStatH, TSnap::GetAnf(), TSnap::GetBfsFullDiam(), TMom::GetMean(), TMom::GetSDev(), TExeTm::GetTmStr(), gsdHops, gsdWccHops, gsvEffDiam, gsvEffDiamDev, gsvEffWccDiam, gsvEffWccDiamDev, gsvFullDiam, gsvFullDiamDev, TFSet::In(), TVec< TVal, TSizeTy >::Len(), NDiamRuns, SetVal(), and TExeTm::Tick().

332  {
333  TExeTm ExeTm;
334  if (! IsMxWcc) {
335  if (StatFSet.In(gsvFullDiam) || StatFSet.In(gsvEffDiam) || StatFSet.In(gsdHops)) {
336  printf("anf:%druns...", NDiamRuns); }
337  //bool Line=false;
338  if (StatFSet.In(gsvEffDiam) || StatFSet.In(gsdHops)) {
339  TMom DiamMom; ExeTm.Tick();
340  TIntFltKdV DistNbrsV;
341  for (int r = 0; r < NDiamRuns; r++) {
342  TSnap::GetAnf(Graph, DistNbrsV, -1, false, 32);
343  DiamMom.Add(TSnap::TSnapDetail::CalcEffDiam(DistNbrsV, 0.9));
344  printf(".");
345  }
346  DiamMom.Def();
347  SetVal(gsvEffDiam, DiamMom.GetMean());
348  SetVal(gsvEffDiamDev, DiamMom.GetSDev());
349  TFltPrV& HopsV = DistrStatH.AddDat(gsdHops);
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)); }
353  printf(" anf-eff %.1f[%s]", DiamMom.GetMean(), ExeTm.GetTmStr());
354  //Line=true;
355  }
356  } else {
357  if (StatFSet.In(gsvEffWccDiam) || StatFSet.In(gsdWccHops)) { printf("wcc diam..."); }
358  //bool Line=false;
359  if (StatFSet.In(gsvFullDiam)) {
360  TMom DiamMom; ExeTm.Tick();
361  for (int r = 0; r < NDiamRuns; r++) {
362  DiamMom.Add(TSnap::GetBfsFullDiam(Graph, 1, false));
363  printf("."); }
364  DiamMom.Def();
365  SetVal(gsvFullDiam, DiamMom.GetMean());
366  SetVal(gsvFullDiamDev, DiamMom.GetSDev());
367  printf(" bfs-full %g[%s]", DiamMom.GetMean(), ExeTm.GetTmStr());
368  //Line=true;
369  }
370  if (StatFSet.In(gsvEffWccDiam) || StatFSet.In(gsdWccHops)) {
371  TMom DiamMom; ExeTm.Tick();
372  TIntFltKdV DistNbrsV;
373  for (int r = 0; r < NDiamRuns; r++) {
374  TSnap::GetAnf(Graph, DistNbrsV, -1, false, 32);
375  DiamMom.Add(TSnap::TSnapDetail::CalcEffDiam(DistNbrsV, 0.9));
376  printf(".");
377  }
378  DiamMom.Def();
379  SetVal(gsvEffWccDiam, DiamMom.GetMean());
380  SetVal(gsvEffWccDiamDev, DiamMom.GetSDev());
381  TFltPrV& WccHopsV = DistrStatH.AddDat(gsdWccHops);
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)); }
385  printf(" anf-wcceff %.1f[%s]", DiamMom.GetMean(), ExeTm.GetTmStr());
386  //Line=true;
387  }
388  }
389 }
Definition: tm.h:355
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 ...
Definition: bfsdfs.h:407
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
void GetAnf(const PGraph &Graph, const int &SrcNId, TIntFltKdV &DistNbrsV, const int &MxDist, const bool &IsDir, const int &NApprox=32)
Definition: anf.h:204
Definition: xmath.h:129
double GetSDev() const
Definition: xmath.h:242
Definition: gstat.h:29
const char * GetTmStr() const
Definition: tm.h:370
void Add(const TFlt &Val, const TFlt &Wgt=1)
Definition: xmath.h:217
THash< TInt, TFltPrV > DistrStatH
Definition: gstat.h:58
void Tick()
Definition: tm.h:364
TPair< TFlt, TFlt > TFltPr
Definition: ds.h:99
void SetVal(const TGStatVal &StatVal, const double &Val)
Definition: gstat.cpp:88
static int NDiamRuns
Definition: gstat.h:38
double CalcEffDiam(const TIntFltKdV &DistNbrsCdfV, const double &Percentile)
Helper function for computing a given Percentile of a (unnormalized) cumulative distribution function...
Definition: anf.cpp:7
double GetMean() const
Definition: xmath.h:240
void Def()
Definition: xmath.cpp:339
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
bool In(const int &FlagN) const
Definition: bits.h:156

Here is the call graph for this function:

template<class PGraph >
void TGStat::TakeSccStat ( const PGraph &  Graph,
TFSet  StatFSet 
)

Definition at line 421 of file gstat.h.

References TSnap::GetMxScc(), TExeTm::GetTmStr(), gsvSccEdges, gsvSccNodes, gsvSccSize, TFSet::In(), and SetVal().

Referenced by TakeStat().

421  {
422  TExeTm ExeTm;
423  if (StatFSet.In(gsvSccNodes) || StatFSet.In(gsvSccEdges) || StatFSet.In(gsvSccSize)) {
424  printf("scc...");
425  PGraph SccG = TSnap::GetMxScc(Graph);
426  SetVal(gsvSccNodes, SccG->GetNodes());
427  SetVal(gsvSccEdges, SccG->GetEdges());
428  SetVal(gsvSccSize, SccG->GetNodes()/double(Graph->GetNodes()));
429  printf("[%s] ", ExeTm.GetTmStr());
430  }
431 }
Definition: tm.h:355
const char * GetTmStr() const
Definition: tm.h:370
void SetVal(const TGStatVal &StatVal, const double &Val)
Definition: gstat.cpp:88
PGraph GetMxScc(const PGraph &Graph)
Returns a graph representing the largest strongly connected component on an input Graph...
Definition: cncom.h:469
bool In(const int &FlagN) const
Definition: bits.h:156

Here is the call graph for this function:

Here is the caller graph for this function:

void TGStat::TakeSpectral ( const PNGraph Graph,
const int  _TakeSngVals = -1 
)

Definition at line 169 of file gstat.cpp.

References gsdSngVal, and gsdSngVec.

Referenced by TakeStat().

169  {
170  TakeSpectral(Graph, TFSet() | gsdSngVal | gsdSngVec, _TakeSngVals);
171 }
void TakeSpectral(const PNGraph &Graph, const int _TakeSngVals=-1)
Definition: gstat.cpp:169
Definition: bits.h:119

Here is the caller graph for this function:

void TGStat::TakeSpectral ( const PNGraph Graph,
TFSet  StatFSet,
int  _TakeSngVals = -1 
)

Definition at line 173 of file gstat.cpp.

References TVec< TVal, TSizeTy >::Add(), DistrStatH, TVec< TVal, TSizeTy >::Gen(), TNGraph::GetNodes(), TSnap::GetSngVals(), TSnap::GetSngVec(), TExeTm::GetTmStr(), gsdSngVal, gsdSngVec, TFSet::In(), Kilo, TVec< TVal, TSizeTy >::Len(), TMath::Mn(), TVec< TVal, TSizeTy >::Sort(), and TakeSngVals.

173  {
174  TExeTm ExeTm;
175  if (_TakeSngVals == -1) { _TakeSngVals = TakeSngVals; }
176  // singular values, vectors
177  if (StatFSet.In(gsdSngVal)) {
178  printf("sing-vals...");
179  const int SngVals = TMath::Mn(_TakeSngVals, Graph->GetNodes()/2);
180  TFltV SngValV1;
181  TSnap::GetSngVals(Graph, SngVals, SngValV1);
182  SngValV1.Sort(false);
183  TFltPrV& SngValV = DistrStatH.AddDat(gsdSngVal);
184  SngValV.Gen(SngValV1.Len(), 0);
185  for (int i = 0; i < SngValV1.Len(); i++) {
186  SngValV.Add(TFltPr(i+1, SngValV1[i]));
187  }
188  printf("[%s] ", ExeTm.GetTmStr());
189  }
190  if (StatFSet.In(gsdSngVec)) {
191  printf("sing-vec...");
192  TFltV LeftV, RightV;
193  TSnap::GetSngVec(Graph, LeftV, RightV);
194  LeftV.Sort(false);
195  TFltPrV& SngVec = DistrStatH.AddDat(gsdSngVec);
196  SngVec.Gen(LeftV.Len(), 0);
197  for (int i = 0; i < TMath::Mn(Kilo(10), LeftV.Len()/2); i++) {
198  if (LeftV[i] > 0) { SngVec.Add(TFltPr(i+1, LeftV[i])); }
199  }
200  printf("[%s] ", ExeTm.GetTmStr());
201  }
202 }
static const T & Mn(const T &LVal, const T &RVal)
Definition: xmath.h:36
Definition: tm.h:355
#define Kilo(n)
Definition: gbase.h:3
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
int GetNodes() const
Returns the number of nodes in the graph.
Definition: graph.h:499
const char * GetTmStr() const
Definition: tm.h:370
void GetSngVec(const PNGraph &Graph, TFltV &LeftSV, TFltV &RightSV)
Computes the leading left and right singular vector of the adjacency matrix representing a directed G...
Definition: gsvd.cpp:225
void Sort(const bool &Asc=true)
Sorts the elements of the vector.
Definition: ds.h:1318
THash< TInt, TFltPrV > DistrStatH
Definition: gstat.h:58
TPair< TFlt, TFlt > TFltPr
Definition: ds.h:99
void GetSngVals(const PNGraph &Graph, const int &SngVals, TFltV &SngValV)
Computes largest SngVals singular values of the adjacency matrix representing a directed Graph...
Definition: gsvd.cpp:175
static int TakeSngVals
Definition: gstat.h:39
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
bool In(const int &FlagN) const
Definition: bits.h:156

Here is the call graph for this function:

void TGStat::TakeStat ( const PNGraph Graph,
const TSecTm Time,
TFSet  StatFSet,
const TStr GraphName 
)

Definition at line 105 of file gstat.cpp.

References TStr::CStr(), TNGraph::GetEdges(), TSnap::GetMxWcc(), TNGraph::GetNodes(), TSecTm::GetStr(), GraphNm, gsdClustCf, gsdTriadPart, gsdWcc, gsdWccHops, gsvClustCf, gsvEffWccDiam, gsvFullDiam, gsvNone, gsvWccBiDirEdges, gsvWccDstNodes, gsvWccEdges, gsvWccNodes, gsvWccSize, gsvWccSrcNodes, gsvWccUniqEdges, TFSet::In(), TSecTm::IsDef(), SetVal(), TakeBasicStat(), TakeBccStat(), TakeClustCf(), TakeConnComp(), TakeDegDistr(), TakeDiam(), TakeSccStat(), TakeSpectral(), TakeTriadPart(), and Time.

Referenced by TGStat().

105  {
106  printf("\n===TakeStat: G(%u, %u) at %s\n", Graph->GetNodes(), Graph->GetEdges(), _Time.IsDef()?_Time.GetStr().CStr():"");
107  TExeTm ExeTm, FullTm;
108  Time = _Time;
109  GraphNm = GraphName;
110  if (StatFSet.In(gsvNone)) { return; }
111  TakeBasicStat(Graph, false);
112  TakeDiam(Graph, StatFSet, false);
113  if (StatFSet.In(gsdWcc) || StatFSet.In(gsdWccHops) || StatFSet.In(gsvFullDiam) || StatFSet.In(gsvEffWccDiam) || StatFSet.In(gsvWccNodes) || StatFSet.In(gsvWccSrcNodes) || StatFSet.In(gsvWccDstNodes) || StatFSet.In(gsvWccEdges) || StatFSet.In(gsvWccUniqEdges) || StatFSet.In(gsvWccBiDirEdges)) {
114  PNGraph WccGraph = TSnap::GetMxWcc(Graph);
115  TakeBasicStat(WccGraph, true);
116  TakeDiam(WccGraph, StatFSet, true);
117  SetVal(gsvWccSize, WccGraph->GetNodes()/double(Graph->GetNodes()));
118  }
119  // strongly connected component
120  TakeSccStat(Graph, StatFSet);
121  // strongly connected component
122  TakeBccStat(Graph, StatFSet);
123  // degrees
124  TakeDegDistr(Graph, StatFSet);
125  // components
126  TakeConnComp(Graph, StatFSet);
127  // spectral
128  TakeSpectral(Graph, StatFSet, -1);
129  // clustering coeffient
130  if (StatFSet.In(gsdClustCf) || StatFSet.In(gsvClustCf)) {
131  TakeClustCf(Graph); }
132  if (StatFSet.In(gsdTriadPart)) {
133  TakeTriadPart(Graph); }
134  printf("**[%s]\n", FullTm.GetTmStr());
135 }
Definition: tm.h:355
TStr GraphNm
Definition: gstat.h:56
PGraph GetMxWcc(const PGraph &Graph)
Returns a graph representing the largest weakly connected component on an input Graph.
Definition: cncom.h:452
void TakeSpectral(const PNGraph &Graph, const int _TakeSngVals=-1)
Definition: gstat.cpp:169
int GetEdges() const
Returns the number of edges in the graph.
Definition: graph.cpp:313
void TakeConnComp(const PGraph &Graph)
Definition: gstat.h:392
int GetNodes() const
Returns the number of nodes in the graph.
Definition: graph.h:499
Definition: gstat.h:16
void TakeTriadPart(const PGraph &Graph)
Definition: gstat.h:460
void TakeClustCf(const PGraph &Graph, const int &SampleNodes=-1)
Definition: gstat.h:447
void TakeBccStat(const PGraph &Graph, TFSet StatFSet)
Definition: gstat.h:434
void SetVal(const TGStatVal &StatVal, const double &Val)
Definition: gstat.cpp:88
Definition: gstat.h:28
void TakeSccStat(const PGraph &Graph, TFSet StatFSet)
Definition: gstat.h:421
void TakeDegDistr(const PGraph &Graph)
Definition: gstat.h:301
void TakeBasicStat(const PGraph &Graph, const bool &IsMxWcc=false)
Definition: gstat.h:257
void TakeDiam(const PGraph &Graph, const bool &IsMxWcc=false)
Definition: gstat.h:326
bool In(const int &FlagN) const
Definition: bits.h:156

Here is the call graph for this function:

Here is the caller graph for this function:

void TGStat::TakeStat ( const PUNGraph Graph,
const TSecTm Time,
TFSet  StatFSet,
const TStr GraphName 
)

Definition at line 137 of file gstat.cpp.

References TStr::CStr(), TUNGraph::GetEdges(), TSnap::GetMxWcc(), TUNGraph::GetNodes(), TSecTm::GetStr(), GraphNm, gsdClustCf, gsdTriadPart, gsdWcc, gsdWccHops, gsvClustCf, gsvEffWccDiam, gsvFullDiam, gsvNone, gsvWccBiDirEdges, gsvWccDstNodes, gsvWccEdges, gsvWccNodes, gsvWccSize, gsvWccSrcNodes, gsvWccUniqEdges, TFSet::In(), TSecTm::IsDef(), SetVal(), TakeBasicStat(), TakeBccStat(), TakeClustCf(), TakeConnComp(), TakeDegDistr(), TakeDiam(), TakeTriadPart(), and Time.

137  {
138  printf("\n===TakeStat: UG(%u, %u) at %s\n", Graph->GetNodes(), Graph->GetEdges(), _Time.IsDef()?_Time.GetStr().CStr():"");
139  TExeTm ExeTm, FullTm;
140  Time = _Time;
141  GraphNm = GraphName;
142  if (StatFSet.In(gsvNone)) { return; }
143  TakeBasicStat(Graph, false);
144  TakeDiam(Graph, StatFSet, false);
145  if (StatFSet.In(gsdWcc) || StatFSet.In(gsdWccHops) || StatFSet.In(gsvFullDiam) || StatFSet.In(gsvEffWccDiam) || StatFSet.In(gsvWccNodes) || StatFSet.In(gsvWccSrcNodes) || StatFSet.In(gsvWccDstNodes) || StatFSet.In(gsvWccEdges) || StatFSet.In(gsvWccUniqEdges) || StatFSet.In(gsvWccBiDirEdges)) {
146  PUNGraph WccGraph = TSnap::GetMxWcc(Graph);
147  TakeBasicStat(WccGraph, true);
148  TakeDiam(WccGraph, StatFSet, true);
149  SetVal(gsvWccSize, WccGraph->GetNodes()/double(Graph->GetNodes()));
150  }
151  // strongly connected component
152  //TakeSccStat(Graph, StatFSet);
153  // strongly connected component
154  TakeBccStat(Graph, StatFSet);
155  // degrees
156  TakeDegDistr(Graph, StatFSet);
157  // components
158  TakeConnComp(Graph, StatFSet);
159  // spectral
160  //TakeSpectral(Graph, StatFSet, -1);
161  // clustering coeffient
162  if (StatFSet.In(gsdClustCf) || StatFSet.In(gsvClustCf)) {
163  TakeClustCf(Graph); }
164  if (StatFSet.In(gsdTriadPart)) {
165  TakeTriadPart(Graph); }
166  printf("**[%s]\n", FullTm.GetTmStr());
167 }
Definition: tm.h:355
TStr GraphNm
Definition: gstat.h:56
PGraph GetMxWcc(const PGraph &Graph)
Returns a graph representing the largest weakly connected component on an input Graph.
Definition: cncom.h:452
void TakeConnComp(const PGraph &Graph)
Definition: gstat.h:392
Definition: gstat.h:16
void TakeTriadPart(const PGraph &Graph)
Definition: gstat.h:460
void TakeClustCf(const PGraph &Graph, const int &SampleNodes=-1)
Definition: gstat.h:447
void TakeBccStat(const PGraph &Graph, TFSet StatFSet)
Definition: gstat.h:434
void SetVal(const TGStatVal &StatVal, const double &Val)
Definition: gstat.cpp:88
Definition: gstat.h:28
Definition: bd.h:196
void TakeDegDistr(const PGraph &Graph)
Definition: gstat.h:301
void TakeBasicStat(const PGraph &Graph, const bool &IsMxWcc=false)
Definition: gstat.h:257
void TakeDiam(const PGraph &Graph, const bool &IsMxWcc=false)
Definition: gstat.h:326
bool In(const int &FlagN) const
Definition: bits.h:156

Here is the call graph for this function:

template<class PGraph >
void TGStat::TakeStat ( const PGraph &  Graph,
const TSecTm Time,
TFSet  StatFSet,
const TStr GraphName 
)

Definition at line 219 of file gstat.h.

References TSnap::GetMxWcc(), GraphNm, gsdClustCf, gsdHops, gsdScc, gsdTriadPart, gsdWcc, gsdWccHops, gsvClustCf, gsvEffDiam, gsvEffWccDiam, gsvFullDiam, gsvNone, gsvWccSize, TFSet::In(), SetVal(), TakeBasicStat(), TakeBccStat(), TakeClustCf(), TakeConnComp(), TakeDegDistr(), TakeDiam(), TakeSccStat(), TakeSpectral(), and TakeTriadPart().

219  {
220  printf("**TakeStat: G(%u, %u)\n", Graph->GetNodes(), Graph->GetEdges());
221  TExeTm ExeTm, FullTm;
222  Time = _Time;
223  GraphNm = GraphName;
224  if (StatFSet.In(gsvNone)) { return; }
225  TakeBasicStat(Graph, false);
226  TakeSccStat(Graph, StatFSet);
227  TakeBccStat(Graph, StatFSet);
228  if (StatFSet.In(gsdWcc)) {
229  PGraph WccG = TSnap::GetMxWcc(Graph);
230  TakeBasicStat(WccG, true);
231  SetVal(gsvWccSize, WccG->GetNodes()/double(Graph->GetNodes()));
232  }
233  // degrees
234  TakeDegDistr(Graph, StatFSet);
235  if (StatFSet.In(gsvFullDiam) || StatFSet.In(gsvEffDiam) || StatFSet.In(gsdHops) ||
236  StatFSet.In(gsvEffWccDiam) || StatFSet.In(gsdWccHops) || StatFSet.In(gsdWcc) || StatFSet.In(gsdScc) ||
237  StatFSet.In(gsdClustCf) || StatFSet.In(gsvClustCf) || StatFSet.In(gsdTriadPart)) {
238  PNGraph NGraph = TSnap::ConvertGraph<PNGraph>(Graph, true);
239  // diameter
240  TakeDiam(NGraph, StatFSet, false);
241  // components
242  TakeConnComp(NGraph, StatFSet);
243  // spectral
244  TakeSpectral(NGraph, StatFSet, -1);
245  // clustering coeffient
246  if (StatFSet.In(gsdClustCf) || StatFSet.In(gsvClustCf)) {
247  TakeClustCf(NGraph); }
248  if (StatFSet.In(gsdTriadPart)) {
249  TakeTriadPart(NGraph); }
250  if (StatFSet.In(gsvFullDiam) || StatFSet.In(gsvEffWccDiam)) {
251  TakeDiam(TSnap::GetMxWcc(NGraph), StatFSet, true); }
252  printf("**[%s]\n", FullTm.GetTmStr());
253  }
254 }
Definition: tm.h:355
TStr GraphNm
Definition: gstat.h:56
PGraph GetMxWcc(const PGraph &Graph)
Returns a graph representing the largest weakly connected component on an input Graph.
Definition: cncom.h:452
void TakeSpectral(const PNGraph &Graph, const int _TakeSngVals=-1)
Definition: gstat.cpp:169
void TakeConnComp(const PGraph &Graph)
Definition: gstat.h:392
Definition: gstat.h:29
Definition: gstat.h:28
Definition: gstat.h:16
void TakeTriadPart(const PGraph &Graph)
Definition: gstat.h:460
void TakeClustCf(const PGraph &Graph, const int &SampleNodes=-1)
Definition: gstat.h:447
void TakeBccStat(const PGraph &Graph, TFSet StatFSet)
Definition: gstat.h:434
void SetVal(const TGStatVal &StatVal, const double &Val)
Definition: gstat.cpp:88
Definition: gstat.h:28
void TakeSccStat(const PGraph &Graph, TFSet StatFSet)
Definition: gstat.h:421
void TakeDegDistr(const PGraph &Graph)
Definition: gstat.h:301
void TakeBasicStat(const PGraph &Graph, const bool &IsMxWcc=false)
Definition: gstat.h:257
void TakeDiam(const PGraph &Graph, const bool &IsMxWcc=false)
Definition: gstat.h:326
bool In(const int &FlagN) const
Definition: bits.h:156

Here is the call graph for this function:

template<class PGraph >
void TGStat::TakeTriadPart ( const PGraph &  Graph)

Definition at line 460 of file gstat.h.

References TVec< TVal, TSizeTy >::Add(), DistrStatH, TVec< TVal, TSizeTy >::Gen(), TExeTm::GetTmStr(), TSnap::GetTriadParticip(), gsdTriadPart, and TVec< TVal, TSizeTy >::Len().

Referenced by TakeStat().

460  {
461  TExeTm ExeTm;
462  printf("triadparticip...");
463  TFltPrV& TriadCntV = DistrStatH.AddDat(gsdTriadPart);
464  TIntPrV CntV;
465  TSnap::GetTriadParticip(Graph, CntV);
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()));
469  }
470  printf("[%s] ", ExeTm.GetTmStr());
471 }
Definition: tm.h:355
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
const char * GetTmStr() const
Definition: tm.h:370
THash< TInt, TFltPrV > DistrStatH
Definition: gstat.h:58
TPair< TFlt, TFlt > TFltPr
Definition: ds.h:99
void GetTriadParticip(const PGraph &Graph, TIntPrV &TriadCntV)
Triangle Participation Ratio: For each node counts how many triangles it participates in and then ret...
Definition: triad.h:648
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class TCmpByVal
friend

Definition at line 149 of file gstat.h.

friend class TPt< TGStat >
friend

Definition at line 150 of file gstat.h.

Member Data Documentation

TCRef TGStat::CRef
private

Definition at line 53 of file gstat.h.

const TFltPrV TGStat::EmptyV = TFltPrV()
staticprivate

Definition at line 52 of file gstat.h.

Referenced by GetDistr().

TStr TGStat::GraphNm

Definition at line 56 of file gstat.h.

Referenced by AvgGStat(), GetNm(), New(), operator=(), Save(), SetNm(), and TakeStat().

int TGStat::NDiamRuns = 10
static

Definition at line 38 of file gstat.h.

Referenced by TFfGGen::GenFFGraphs(), TakeDiam(), and TTimeNENet::TimeGrowth().

int TGStat::TakeSngVals = 100
static

Definition at line 39 of file gstat.h.

Referenced by TakeSpectral().

TIntFltH TGStat::ValStatH

Definition at line 57 of file gstat.h.

Referenced by GetVal(), GetVals(), HasVal(), operator<(), operator=(), operator==(), Save(), and SetVal().


The documentation for this class was generated from the following files: