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
TGStatVec Class Reference

Graph Statistics Sequence. More...

#include <gstat.h>

Collaboration diagram for TGStatVec:

Public Member Functions

 TGStatVec (const TTmUnit &_TmUnit=tmu1Sec)
 
 TGStatVec (const TTmUnit &_TmUnit, const TFSet &TakeGrowthStat)
 
 TGStatVec (const TGStatVec &GStat)
 
 TGStatVec (TSIn &SIn)
 
void Save (TSOut &SOut) const
 
TGStatVecoperator= (const TGStatVec &GStat)
 
PGStat Add ()
 
PGStat Add (const TSecTm &Time, const TStr &GraphNm=TStr())
 
void Add (const PGStat &Growth)
 
void Add (const PNGraph &Graph, const TSecTm &Time, const TStr &GraphNm=TStr())
 
void Add (const PUNGraph &Graph, const TSecTm &Time, const TStr &GraphNm=TStr())
 
void Add (const PNEGraph &Graph, const TSecTm &Time, const TStr &GraphNm=TStr())
 
void Clr ()
 
void Sort (const TGStatVal &SortBy=gsvNodes, const bool &Asc=true)
 
int Len () const
 
bool Empty () const
 
PGStat operator[] (const int &ValN) const
 
PGStat At (const int &ValN) const
 
PGStat Last () const
 
const TGStatVGetGStatV () const
 
int GetTime (const int &ValN) const
 
void Del (const int &ValN)
 
void DelLast ()
 
void DelBefore (const TSecTm &Tm)
 
void DelAfter (const TSecTm &Tm)
 
void DelSmallNodes (const int &MinNodes)
 
void SetTmUnit (const TTmUnit &TimeUnit)
 
TTmUnit GetTmUnit () const
 
void SetTakeStat (const TFSet &TakeStatSet)
 
bool HasVal (const TGStatVal &Stat) const
 
bool HasDistr (const TGStatDistr &Stat) const
 
void GetValV (const TGStatVal &XVal, const TGStatVal &YVal, TFltPrV &ValV) const
 
PGStat GetAvgGStat (const bool &ClipAt1=false)
 
void Plot (const TGStatVal &XVal, const TGStatVal &YVal, const TStr &OutFNm, TStr &Desc, const TGpScaleTy &Scale=gpsAuto, const bool &PowerFit=false) const
 
void PlotAllVsX (const TGStatVal &XVal, const TStr &OutFNm, TStr Desc=TStr(), const TGpScaleTy &Scale=gpsAuto, const bool &PowerFit=false) const
 
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 SaveTxt (const TStr &FNmPref, const TStr &Desc) const
 

Static Public Member Functions

static PGStatVec New (const TTmUnit &_TmUnit=tmu1Sec)
 
static PGStatVec New (const TTmUnit &_TmUnit, const TFSet &TakeGrowthStat)
 
static PGStatVec Load (TSIn &SIn)
 

Static Public Attributes

static uint MinNodesEdges = 10
 

Private Attributes

TCRef CRef
 
TTmUnit TmUnit
 
TFSet StatFSet
 
TGStatV GStatV
 

Friends

class TPt< TGStatVec >
 

Detailed Description

Graph Statistics Sequence.

Definition at line 155 of file gstat.h.

Constructor & Destructor Documentation

TGStatVec::TGStatVec ( const TTmUnit _TmUnit = tmu1Sec)

Definition at line 411 of file gstat.cpp.

References TGStat::AllStat(), and StatFSet.

Referenced by Load(), and New().

411  : TmUnit(_TmUnit), StatFSet(), GStatV() {
413 }
static TFSet AllStat()
Definition: gstat.cpp:401
TTmUnit TmUnit
Definition: gstat.h:160
TGStatV GStatV
Definition: gstat.h:162
TFSet StatFSet
Definition: gstat.h:161

Here is the call graph for this function:

Here is the caller graph for this function:

TGStatVec::TGStatVec ( const TTmUnit _TmUnit,
const TFSet TakeGrowthStat 
)

Definition at line 415 of file gstat.cpp.

415  :
416  TmUnit(_TmUnit), StatFSet(TakeGrowthStat), GStatV() {
417 }
TTmUnit TmUnit
Definition: gstat.h:160
TGStatV GStatV
Definition: gstat.h:162
TFSet StatFSet
Definition: gstat.h:161
TGStatVec::TGStatVec ( const TGStatVec GStat)

Definition at line 419 of file gstat.cpp.

419  :
420  TmUnit(GStat.TmUnit), StatFSet(GStat.StatFSet), GStatV(GStat.GStatV) {
421 }
TTmUnit TmUnit
Definition: gstat.h:160
TGStatV GStatV
Definition: gstat.h:162
TFSet StatFSet
Definition: gstat.h:161
TGStatVec::TGStatVec ( TSIn SIn)

Definition at line 423 of file gstat.cpp.

423  : TmUnit((TTmUnit) TInt(SIn).Val), StatFSet(SIn), GStatV(SIn) {
424 }
TTmUnit TmUnit
Definition: gstat.h:160
TGStatV GStatV
Definition: gstat.h:162
TFSet StatFSet
Definition: gstat.h:161
Definition: dt.h:1134
TTmUnit
Definition: tm.h:11

Member Function Documentation

PGStat TGStatVec::Add ( )

Definition at line 449 of file gstat.cpp.

References TVec< TVal, TSizeTy >::Add(), GStatV, TVec< TVal, TSizeTy >::Last(), and TGStat::New().

Referenced by Add(), and TMAGFitBern::PlotProperties().

449  {
451  return GStatV.Last();
452 }
TGStatV GStatV
Definition: gstat.h:162
static PGStat New(const TSecTm &Time=TSecTm(), const TStr &GraphName=TStr())
Definition: gstat.h:69
const TVal & Last() const
Returns a reference to the last element of the vector.
Definition: ds.h:579
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602

Here is the call graph for this function:

Here is the caller graph for this function:

PGStat TGStatVec::Add ( const TSecTm Time,
const TStr GraphNm = TStr() 
)

Definition at line 454 of file gstat.cpp.

References TVec< TVal, TSizeTy >::Add(), GStatV, TVec< TVal, TSizeTy >::Last(), and TGStat::New().

454  {
455  GStatV.Add(TGStat::New(Time, GraphNm));
456  return GStatV.Last();
457 }
TGStatV GStatV
Definition: gstat.h:162
static PGStat New(const TSecTm &Time=TSecTm(), const TStr &GraphName=TStr())
Definition: gstat.h:69
const TVal & Last() const
Returns a reference to the last element of the vector.
Definition: ds.h:579
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602

Here is the call graph for this function:

void TGStatVec::Add ( const PGStat Growth)
inline

Definition at line 176 of file gstat.h.

References TVec< TVal, TSizeTy >::Add(), and GStatV.

176 { GStatV.Add(Growth); }
TGStatV GStatV
Definition: gstat.h:162
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602

Here is the call graph for this function:

void TGStatVec::Add ( const PNGraph Graph,
const TSecTm Time,
const TStr GraphNm = TStr() 
)

Definition at line 459 of file gstat.cpp.

References Add(), TNGraph::GetNodes(), MinNodesEdges, TGStat::New(), and StatFSet.

459  {
460  if (Graph->GetNodes() < (int) TGStatVec::MinNodesEdges) {
461  printf(" ** TGStatVec::Add: graph too small (%d nodes).SKIP\n", Graph->GetNodes());
462  return;
463  }
464  Add(TGStat::New(Graph, Time, StatFSet, GraphNm));
465 }
PGStat Add()
Definition: gstat.cpp:449
int GetNodes() const
Returns the number of nodes in the graph.
Definition: graph.h:499
static PGStat New(const TSecTm &Time=TSecTm(), const TStr &GraphName=TStr())
Definition: gstat.h:69
TFSet StatFSet
Definition: gstat.h:161
static uint MinNodesEdges
Definition: gstat.h:157

Here is the call graph for this function:

void TGStatVec::Add ( const PUNGraph Graph,
const TSecTm Time,
const TStr GraphNm = TStr() 
)

Definition at line 467 of file gstat.cpp.

References Add(), TUNGraph::GetNodes(), MinNodesEdges, TGStat::New(), and StatFSet.

467  {
468  if (Graph->GetNodes() < (int) TGStatVec::MinNodesEdges) {
469  printf(" ** TGStatVec::Add: graph too small (%d nodes).SKIP\n", Graph->GetNodes());
470  return;
471  }
472  Add(TGStat::New(Graph, Time, StatFSet, GraphNm));
473 }
PGStat Add()
Definition: gstat.cpp:449
static PGStat New(const TSecTm &Time=TSecTm(), const TStr &GraphName=TStr())
Definition: gstat.h:69
TFSet StatFSet
Definition: gstat.h:161
static uint MinNodesEdges
Definition: gstat.h:157

Here is the call graph for this function:

void TGStatVec::Add ( const PNEGraph Graph,
const TSecTm Time,
const TStr GraphNm = TStr() 
)

Definition at line 475 of file gstat.cpp.

References Add(), MinNodesEdges, TGStat::New(), and StatFSet.

475  {
476  if (Graph->GetNodes() < (int) TGStatVec::MinNodesEdges) {
477  printf(" ** TGStatVec::Add: graph too small (%d nodes).SKIP\n", Graph->GetNodes());
478  return;
479  }
480  Add(TGStat::New(Graph, Time, StatFSet, GraphNm));
481 }
PGStat Add()
Definition: gstat.cpp:449
static PGStat New(const TSecTm &Time=TSecTm(), const TStr &GraphName=TStr())
Definition: gstat.h:69
TFSet StatFSet
Definition: gstat.h:161
static uint MinNodesEdges
Definition: gstat.h:157

Here is the call graph for this function:

PGStat TGStatVec::At ( const int &  ValN) const
inline

Definition at line 186 of file gstat.h.

References GStatV.

Referenced by DelAfter(), DelBefore(), DelSmallNodes(), GetTime(), GetValV(), ImposeDistr(), TMAGFitBern::PlotProperties(), and SaveTxt().

186 { return GStatV[ValN]; }
TGStatV GStatV
Definition: gstat.h:162

Here is the caller graph for this function:

void TGStatVec::Clr ( )
inline

Definition at line 180 of file gstat.h.

References TVec< TVal, TSizeTy >::Clr(), and GStatV.

180 { GStatV.Clr(); }
TGStatV GStatV
Definition: gstat.h:162
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:1022

Here is the call graph for this function:

void TGStatVec::Del ( const int &  ValN)
inline

Definition at line 191 of file gstat.h.

References TVec< TVal, TSizeTy >::Del(), and GStatV.

191 { GStatV.Del(ValN); }
void Del(const TSizeTy &ValN)
Removes the element at position ValN.
Definition: ds.h:1189
TGStatV GStatV
Definition: gstat.h:162

Here is the call graph for this function:

void TGStatVec::DelAfter ( const TSecTm Tm)

Definition at line 495 of file gstat.cpp.

References TVec< TVal, TSizeTy >::Add(), At(), GStatV, Len(), and TVec< TVal, TSizeTy >::Swap().

495  {
496  TGStatV NewTickV;
497  for (int i = 0; i < Len(); i++) {
498  if (At(i)->Time <= Tm) { NewTickV.Add(At(i)); }
499  }
500  GStatV.Swap(NewTickV);
501 }
TGStatV GStatV
Definition: gstat.h:162
int Len() const
Definition: gstat.h:183
void Swap(TVec< TVal, TSizeTy > &Vec)
Swaps the contents of the vector with Vec.
Definition: ds.h:1101
PGStat At(const int &ValN) const
Definition: gstat.h:186
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602

Here is the call graph for this function:

void TGStatVec::DelBefore ( const TSecTm Tm)

Definition at line 487 of file gstat.cpp.

References TVec< TVal, TSizeTy >::Add(), At(), GStatV, Len(), and TVec< TVal, TSizeTy >::Swap().

487  {
488  TGStatV NewTickV;
489  for (int i = 0; i < Len(); i++) {
490  if (At(i)->Time >= Tm) { NewTickV.Add(At(i)); }
491  }
492  GStatV.Swap(NewTickV);
493 }
TGStatV GStatV
Definition: gstat.h:162
int Len() const
Definition: gstat.h:183
void Swap(TVec< TVal, TSizeTy > &Vec)
Swaps the contents of the vector with Vec.
Definition: ds.h:1101
PGStat At(const int &ValN) const
Definition: gstat.h:186
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602

Here is the call graph for this function:

void TGStatVec::DelLast ( )
inline

Definition at line 192 of file gstat.h.

References TVec< TVal, TSizeTy >::DelLast(), and GStatV.

192 { GStatV.DelLast(); }
TGStatV GStatV
Definition: gstat.h:162
void DelLast()
Removes the last element of the vector.
Definition: ds.h:665

Here is the call graph for this function:

void TGStatVec::DelSmallNodes ( const int &  MinNodes)

Definition at line 503 of file gstat.cpp.

References TVec< TVal, TSizeTy >::Add(), At(), GStatV, Len(), and TVec< TVal, TSizeTy >::Swap().

503  {
504  TGStatV NewTickV;
505  for (int i = 0; i < Len(); i++) {
506  if (At(i)->GetNodes() >= MinNodes) { NewTickV.Add(At(i)); }
507  }
508  GStatV.Swap(NewTickV);
509 }
TGStatV GStatV
Definition: gstat.h:162
int Len() const
Definition: gstat.h:183
void Swap(TVec< TVal, TSizeTy > &Vec)
Swaps the contents of the vector with Vec.
Definition: ds.h:1101
PGStat At(const int &ValN) const
Definition: gstat.h:186
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602

Here is the call graph for this function:

bool TGStatVec::Empty ( ) const
inline

Definition at line 184 of file gstat.h.

References TVec< TVal, TSizeTy >::Empty(), and GStatV.

184 { return GStatV.Empty(); }
TGStatV GStatV
Definition: gstat.h:162
bool Empty() const
Tests whether the vector is empty.
Definition: ds.h:570

Here is the call graph for this function:

PGStat TGStatVec::GetAvgGStat ( const bool &  ClipAt1 = false)

Definition at line 523 of file gstat.cpp.

References GStatV, and TGStat::New().

523  {
524  PGStat Stat = TGStat::New();
525  Stat->AvgGStat(GStatV, ClipAt1);
526  return Stat;
527 }
TGStatV GStatV
Definition: gstat.h:162
static PGStat New(const TSecTm &Time=TSecTm(), const TStr &GraphName=TStr())
Definition: gstat.h:69
Definition: bd.h:196

Here is the call graph for this function:

const TGStatV& TGStatVec::GetGStatV ( ) const
inline

Definition at line 188 of file gstat.h.

References GStatV.

188 { return GStatV; }
TGStatV GStatV
Definition: gstat.h:162
int TGStatVec::GetTime ( const int &  ValN) const
inline

Definition at line 189 of file gstat.h.

References At(), and TmUnit.

Referenced by GetValV().

189 { return At(ValN)->GetTime(TmUnit); }
TTmUnit TmUnit
Definition: gstat.h:160
PGStat At(const int &ValN) const
Definition: gstat.h:186

Here is the call graph for this function:

Here is the caller graph for this function:

TTmUnit TGStatVec::GetTmUnit ( ) const
inline

Definition at line 198 of file gstat.h.

References TmUnit.

198 { return TmUnit; }
TTmUnit TmUnit
Definition: gstat.h:160
void TGStatVec::GetValV ( const TGStatVal XVal,
const TGStatVal YVal,
TFltPrV ValV 
) const

Definition at line 511 of file gstat.cpp.

References TVec< TVal, TSizeTy >::Add(), At(), TVec< TVal, TSizeTy >::Gen(), GetTime(), gsvIndex, gsvTime, Len(), and TVec< TVal, TSizeTy >::Sort().

Referenced by Plot().

511  {
512  ValV.Gen(Len(), 0);
513  double x;
514  for (int t = 0; t < Len(); t++) {
515  if (XVal == gsvIndex) { x = t+1; }
516  else if (XVal == gsvTime) { x = GetTime(t); }
517  else { x = At(t)->GetVal(XVal); }
518  ValV.Add(TFltPr(x, At(t)->GetVal(YVal)));
519  }
520  ValV.Sort(true); // sort by ascending x value
521 }
int Len() const
Definition: gstat.h:183
int GetTime(const int &ValN) const
Definition: gstat.h:189
Definition: gstat.h:16
void Sort(const bool &Asc=true)
Sorts the elements of the vector.
Definition: ds.h:1318
Definition: gstat.h:16
TPair< TFlt, TFlt > TFltPr
Definition: ds.h:99
PGStat At(const int &ValN) const
Definition: gstat.h:186
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

Here is the call graph for this function:

Here is the caller graph for this function:

bool TGStatVec::HasDistr ( const TGStatDistr Stat) const
inline

Definition at line 201 of file gstat.h.

References TFSet::In(), and StatFSet.

Referenced by ImposeDistr().

201 { return StatFSet.In(Stat); }
TFSet StatFSet
Definition: gstat.h:161
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:

bool TGStatVec::HasVal ( const TGStatVal Stat) const
inline

Definition at line 200 of file gstat.h.

References TFSet::In(), and StatFSet.

Referenced by Plot().

200 { return StatFSet.In(Stat); }
TFSet StatFSet
Definition: gstat.h:161
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 TGStatVec::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

Definition at line 559 of file gstat.cpp.

References TGnuPlot::AddPlot(), TGnuPlot::AddPwrFit(), At(), TStr::CStr(), TStr::Empty(), TStr::Fmt(), TStr::GetUc(), gpwLines, gsdMx, gsdUndef, HasDistr(), Last(), Len(), TGnuPlot::MakeExpBins(), 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.

560  {
561  if (Desc.Empty()) Desc = FNmPref.GetUc();
562  if (! At(0)->HasDistr(Distr) || Distr==gsdUndef || Distr==gsdMx) { return; }
563  TGStat::TPlotInfo Info = At(0)->GetPlotInfo(Distr);
564  TGnuPlot GnuPlot(Info.Val1+TStr(".")+FNmPref, TStr::Fmt("%s. G(%d, %d) --> G(%d, %d)", Desc.CStr(),
565  At(0)->GetNodes(), At(0)->GetEdges(), Last()->GetNodes(), Last()->GetEdges()));
566  GnuPlot.SetXYLabel(Info.Val2, Info.Val3);
567  GnuPlot.SetScale(Info.Val4);
568  int plotId;
569  for (int at = 0; at < Len(); at++) {
570  TStr Legend = At(at)->GetNm();
571  if (Legend.Empty()) { Legend = At(at)->GetTmStr(); }
572  if (! ExpBin) {
573  plotId = GnuPlot.AddPlot(At(at)->GetDistr(Distr), PlotWith, Legend, Style); }
574  else {
575  TFltPrV ExpBinV;
576  TGnuPlot::MakeExpBins(At(at)->GetDistr(Distr), ExpBinV, 2, 0);
577  plotId = GnuPlot.AddPlot(ExpBinV, PlotWith, Legend, Style);
578  }
579  if (PowerFit) { GnuPlot.AddPwrFit(plotId, gpwLines); }
580  }
581  GnuPlot.SavePng();
582 }
static void MakeExpBins(const TFltPrV &XYValV, TFltPrV &ExpXYValV, const double &BinFactor=2, const double &MinYVal=1)
Definition: gnuplot.cpp:614
TStr GetUc() const
Definition: dt.h:493
TVal2 Val2
Definition: ds.h:222
TVal3 Val3
Definition: ds.h:223
bool HasDistr(const TGStatDistr &Stat) const
Definition: gstat.h:201
TVal1 Val1
Definition: ds.h:221
int Len() const
Definition: gstat.h:183
Definition: gstat.h:28
TVal4 Val4
Definition: ds.h:224
PGStat At(const int &ValN) const
Definition: gstat.h:186
PGStat Last() const
Definition: gstat.h:187
Definition: dt.h:412
Definition: ds.h:219
bool Empty() const
Definition: dt.h:488
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
char * CStr()
Definition: dt.h:476
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:

PGStat TGStatVec::Last ( ) const
inline

Definition at line 187 of file gstat.h.

References GStatV, and TVec< TVal, TSizeTy >::Last().

Referenced by ImposeDistr(), Plot(), and PlotAllVsX().

187 { return GStatV.Last(); }
TGStatV GStatV
Definition: gstat.h:162
const TVal & Last() const
Returns a reference to the last element of the vector.
Definition: ds.h:579

Here is the call graph for this function:

Here is the caller graph for this function:

int TGStatVec::Len ( ) const
inline

Definition at line 183 of file gstat.h.

References GStatV, and TVec< TVal, TSizeTy >::Len().

Referenced by DelAfter(), DelBefore(), DelSmallNodes(), GetValV(), ImposeDistr(), TMAGFitBern::PlotProperties(), and SaveTxt().

183 { return GStatV.Len(); }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TGStatV GStatV
Definition: gstat.h:162

Here is the call graph for this function:

Here is the caller graph for this function:

static PGStatVec TGStatVec::Load ( TSIn SIn)
inlinestatic

Definition at line 169 of file gstat.h.

References TGStatVec().

169 { return new TGStatVec(SIn); }
TGStatVec(const TTmUnit &_TmUnit=tmu1Sec)
Definition: gstat.cpp:411

Here is the call graph for this function:

PGStatVec TGStatVec::New ( const TTmUnit _TmUnit = tmu1Sec)
static

Definition at line 426 of file gstat.cpp.

References TGStatVec().

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

426  {
427  return new TGStatVec(_TmUnit);
428 }
TGStatVec(const TTmUnit &_TmUnit=tmu1Sec)
Definition: gstat.cpp:411

Here is the call graph for this function:

Here is the caller graph for this function:

PGStatVec TGStatVec::New ( const TTmUnit _TmUnit,
const TFSet TakeGrowthStat 
)
static

Definition at line 430 of file gstat.cpp.

References TGStatVec().

430  {
431  return new TGStatVec(_TmUnit, TakeGrowthStat);
432 }
TGStatVec(const TTmUnit &_TmUnit=tmu1Sec)
Definition: gstat.cpp:411

Here is the call graph for this function:

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

Definition at line 440 of file gstat.cpp.

References GStatV, StatFSet, and TmUnit.

440  {
441  if (this != &GStat) {
442  TmUnit = GStat.TmUnit;
443  StatFSet = GStat.StatFSet;
444  GStatV = GStat.GStatV;
445  }
446  return *this;
447 }
TTmUnit TmUnit
Definition: gstat.h:160
TGStatV GStatV
Definition: gstat.h:162
TFSet StatFSet
Definition: gstat.h:161
PGStat TGStatVec::operator[] ( const int &  ValN) const
inline

Definition at line 185 of file gstat.h.

References GStatV.

185 { return GStatV[ValN]; }
TGStatV GStatV
Definition: gstat.h:162
void TGStatVec::Plot ( const TGStatVal XVal,
const TGStatVal YVal,
const TStr OutFNm,
TStr Desc,
const TGpScaleTy Scale = gpsAuto,
const bool &  PowerFit = false 
) const

Definition at line 529 of file gstat.cpp.

References TGnuPlot::AddPlot(), TGnuPlot::AddPwrFit(), TStr::CStr(), TStr::Empty(), TStr::Fmt(), TGStat::GetValStr(), GetValV(), gpwLinesPoints, HasVal(), Last(), TGnuPlot::SavePng(), TGnuPlot::SetScale(), and TGnuPlot::SetXYLabel().

Referenced by PlotAllVsX().

529  {
530  if (! Last()->HasVal(XVal) || ! Last()->HasVal(YVal)) {
531  if (! Last()->HasVal(XVal)) { printf("** Does not have %s statistic\n", TGStat::GetValStr(XVal).CStr()); }
532  if (! Last()->HasVal(YVal)) { printf("** Does not have %s statistic\n", TGStat::GetValStr(YVal).CStr()); }
533  return;
534  }
535  if (Desc.Empty()) { Desc = OutFNm; }
536  TFltPrV ValV;
537  TGStatVec::GetValV(XVal, YVal, ValV);
538  TGnuPlot GP(TStr::Fmt("%s-%s.%s", TGStat::GetValStr(XVal).CStr(), TGStat::GetValStr(YVal).CStr(), OutFNm.CStr()),
539  TStr::Fmt("%s. %s vs. %s. G(%d,%d)", Desc.CStr(), TGStat::GetValStr(XVal).CStr(), TGStat::GetValStr(YVal).CStr(),
540  Last()->GetNodes(), Last()->GetEdges()));
541  GP.SetScale(Scale);
542  GP.SetXYLabel(TGStat::GetValStr(XVal), TGStat::GetValStr(YVal));
543  const int Id = GP.AddPlot(ValV, gpwLinesPoints);
544  if (PowerFit) { GP.AddPwrFit(Id); }
545  GP.SavePng();
546 }
bool HasVal(const TGStatVal &Stat) const
Definition: gstat.h:200
static TStr GetValStr(const TGStatVal &Val)
Definition: gstat.cpp:307
PGStat Last() const
Definition: gstat.h:187
bool Empty() const
Definition: dt.h:488
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
void GetValV(const TGStatVal &XVal, const TGStatVal &YVal, TFltPrV &ValV) const
Definition: gstat.cpp:511
char * CStr()
Definition: dt.h:476
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:

void TGStatVec::PlotAllVsX ( const TGStatVal XVal,
const TStr OutFNm,
TStr  Desc = TStr(),
const TGpScaleTy Scale = gpsAuto,
const bool &  PowerFit = false 
) const

Definition at line 548 of file gstat.cpp.

References gsvEffDiamDev, gsvEffWccDiamDev, gsvFullDiamDev, gsvFullWccDiamDev, gsvMx, gsvNone, TFSet::In(), Last(), and Plot().

548  {
550  for (int stat = gsvNone; stat < gsvMx; stat++) {
551  const TGStatVal Stat = TGStatVal(stat);
552  if (SkipStat.In(Stat)) { continue; }
553  if (Last()->HasVal(Stat) && Last()->HasVal(XVal) && Stat!=XVal) {
554  Plot(XVal, Stat, OutFNm, Desc, Scale, PowerFit);
555  }
556  }
557 }
Definition: bits.h:119
enum TGStatVal_ TGStatVal
Definition: gstat.h:16
PGStat Last() const
Definition: gstat.h:187
Definition: gstat.h:23
void Plot(const TGStatVal &XVal, const TGStatVal &YVal, const TStr &OutFNm, TStr &Desc, const TGpScaleTy &Scale=gpsAuto, const bool &PowerFit=false) const
Definition: gstat.cpp:529
bool In(const int &FlagN) const
Definition: bits.h:156

Here is the call graph for this function:

void TGStatVec::Save ( TSOut SOut) const

Definition at line 434 of file gstat.cpp.

References GStatV, TFSet::Save(), TVec< TVal, TSizeTy >::Save(), TInt::Save(), StatFSet, and TmUnit.

434  {
435  TInt(TmUnit).Save(SOut);
436  StatFSet.Save(SOut);
437  GStatV.Save(SOut);
438 }
void Save(TSOut &SOut) const
Definition: dt.h:1150
TTmUnit TmUnit
Definition: gstat.h:160
TGStatV GStatV
Definition: gstat.h:162
void Save(TSOut &SOut) const
Definition: ds.h:954
void Save(TSOut &SOut) const
Definition: bits.h:135
TFSet StatFSet
Definition: gstat.h:161
Definition: dt.h:1134

Here is the call graph for this function:

void TGStatVec::SaveTxt ( const TStr FNmPref,
const TStr Desc 
) const

Definition at line 584 of file gstat.cpp.

References THashSet< TKey, THashFunc >::AddKey(), At(), TStr::CStr(), TStr::Fmt(), THashSet< TKey, THashFunc >::GetKeyV(), TGStat::GetTmStr(), TTmInfo::GetTmUnitStr(), TGStat::GetVal(), TGStat::GetValStr(), gsvMx, gsvNone, Len(), TVec< TVal, TSizeTy >::Len(), TVec< TVal, TSizeTy >::Sort(), and TmUnit.

584  {
585  FILE *F = fopen(TStr::Fmt("growth.%s.tab", FNmPref.CStr()).CStr(), "wt");
586  fprintf(F, "# %s\n", Desc.CStr());
587  fprintf(F, "# %s", TTmInfo::GetTmUnitStr(TmUnit).CStr());
588  TIntSet StatValSet;
589  for (int i = 0; i < Len(); i++) {
590  for (int v = gsvNone; v < gsvMx; v++) {
591  if (At(i)->HasVal(TGStatVal(v))) { StatValSet.AddKey(v); }
592  }
593  }
594  TIntV StatValV; StatValSet.GetKeyV(StatValV); StatValV.Sort();
595  for (int sv = 0; sv < StatValV.Len(); sv++) {
596  fprintf(F, "\t%s", TGStat::GetValStr(TGStatVal(StatValV[sv].Val)).CStr()); }
597  fprintf(F, "Time\n");
598  for (int i = 0; i < Len(); i++) {
599  const TGStat& G = *At(i);
600  for (int sv = 0; sv < StatValV.Len(); sv++) {
601  fprintf(F, "%g\t", G.GetVal(TGStatVal(StatValV[sv].Val))); }
602  fprintf(F, "%s\n", G.GetTmStr().CStr());
603  }
604  fclose(F);
605 }
static TStr GetValStr(const TGStatVal &Val)
Definition: gstat.cpp:307
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
void GetKeyV(TVec< TKey > &KeyV) const
Definition: shash.h:1347
TTmUnit TmUnit
Definition: gstat.h:160
int Len() const
Definition: gstat.h:183
enum TGStatVal_ TGStatVal
Definition: gstat.h:16
void Sort(const bool &Asc=true)
Sorts the elements of the vector.
Definition: ds.h:1318
Statistics of a Graph Snapshot.
Definition: gstat.h:36
int AddKey(const TKey &Key)
Definition: shash.h:1254
TStr GetTmStr() const
Definition: gstat.h:91
PGStat At(const int &ValN) const
Definition: gstat.h:186
static TStr GetTmUnitStr(const TTmUnit &TmUnit)
Definition: tm.cpp:108
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
double GetVal(const TGStatVal &StatVal) const
Definition: gstat.cpp:81
Definition: gstat.h:23
char * CStr()
Definition: dt.h:476

Here is the call graph for this function:

void TGStatVec::SetTakeStat ( const TFSet TakeStatSet)
inline

Definition at line 199 of file gstat.h.

References StatFSet.

199 { StatFSet = TakeStatSet; }
TFSet StatFSet
Definition: gstat.h:161
void TGStatVec::SetTmUnit ( const TTmUnit TimeUnit)
inline

Definition at line 197 of file gstat.h.

References TmUnit.

197 { TmUnit = TimeUnit; }
TTmUnit TmUnit
Definition: gstat.h:160
void TGStatVec::Sort ( const TGStatVal SortBy = gsvNodes,
const bool &  Asc = true 
)

Definition at line 483 of file gstat.cpp.

References GStatV, and TVec< TVal, TSizeTy >::SortCmp().

483  {
484  GStatV.SortCmp(TGStat::TCmpByVal(SortBy, Asc));
485 }
TGStatV GStatV
Definition: gstat.h:162
void SortCmp(const TCmp &Cmp)
Sorts the elements of the vector using the comparator Cmp.
Definition: ds.h:770

Here is the call graph for this function:

Friends And Related Function Documentation

friend class TPt< TGStatVec >
friend

Definition at line 213 of file gstat.h.

Member Data Documentation

TCRef TGStatVec::CRef
private

Definition at line 159 of file gstat.h.

TGStatV TGStatVec::GStatV
private
uint TGStatVec::MinNodesEdges = 10
static

Definition at line 157 of file gstat.h.

Referenced by Add().

TFSet TGStatVec::StatFSet
private

Definition at line 161 of file gstat.h.

Referenced by Add(), HasDistr(), HasVal(), operator=(), Save(), SetTakeStat(), and TGStatVec().

TTmUnit TGStatVec::TmUnit
private

Definition at line 160 of file gstat.h.

Referenced by GetTime(), GetTmUnit(), operator=(), Save(), SaveTxt(), and SetTmUnit().


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