SNAP Library 2.1, User Reference
2013-09-25 10:47:25
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
Graph Statistics Sequence. More...
#include <gstat.h>
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 |
TGStatVec & | operator= (const TGStatVec &GStat) |
PGStat | Add () |
PGStat | Add (const TSecTm &Time, 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 TGStatV & | GetGStatV () 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 > |
TGStatVec::TGStatVec | ( | const TTmUnit & | _TmUnit = tmu1Sec | ) |
TGStatVec::TGStatVec | ( | const TTmUnit & | _TmUnit, |
const TFSet & | TakeGrowthStat | ||
) |
TGStatVec::TGStatVec | ( | const TGStatVec & | GStat | ) |
TGStatVec::TGStatVec | ( | TSIn & | SIn | ) |
PGStat TGStatVec::Add | ( | ) |
PGStat TGStatVec::Add | ( | const TSecTm & | Time, |
TStr | GraphNm = TStr() |
||
) |
void TGStatVec::Add | ( | const PGStat & | Growth | ) | [inline] |
void TGStatVec::Add | ( | const PNGraph & | Graph, |
const TSecTm & | Time, | ||
const TStr & | GraphNm = TStr() |
||
) |
Definition at line 459 of file gstat.cpp.
{ if (Graph->GetNodes() < (int) TGStatVec::MinNodesEdges) { printf(" ** TGStatVec::Add: graph too small (%d nodes).SKIP\n", Graph->GetNodes()); return; } Add(TGStat::New(Graph, Time, StatFSet, GraphNm)); }
void TGStatVec::Add | ( | const PUNGraph & | Graph, |
const TSecTm & | Time, | ||
const TStr & | GraphNm = TStr() |
||
) |
Definition at line 467 of file gstat.cpp.
{ if (Graph->GetNodes() < (int) TGStatVec::MinNodesEdges) { printf(" ** TGStatVec::Add: graph too small (%d nodes).SKIP\n", Graph->GetNodes()); return; } Add(TGStat::New(Graph, Time, StatFSet, GraphNm)); }
void TGStatVec::Add | ( | const PNEGraph & | Graph, |
const TSecTm & | Time, | ||
const TStr & | GraphNm = TStr() |
||
) |
Definition at line 475 of file gstat.cpp.
{ if (Graph->GetNodes() < (int) TGStatVec::MinNodesEdges) { printf(" ** TGStatVec::Add: graph too small (%d nodes).SKIP\n", Graph->GetNodes()); return; } Add(TGStat::New(Graph, Time, StatFSet, GraphNm)); }
PGStat TGStatVec::At | ( | const int & | ValN | ) | const [inline] |
void TGStatVec::Clr | ( | ) | [inline] |
void TGStatVec::Del | ( | const int & | ValN | ) | [inline] |
void TGStatVec::DelAfter | ( | const TSecTm & | Tm | ) |
void TGStatVec::DelBefore | ( | const TSecTm & | Tm | ) |
void TGStatVec::DelLast | ( | ) | [inline] |
void TGStatVec::DelSmallNodes | ( | const int & | MinNodes | ) |
bool TGStatVec::Empty | ( | ) | const [inline] |
PGStat TGStatVec::GetAvgGStat | ( | const bool & | ClipAt1 = false | ) |
Definition at line 523 of file gstat.cpp.
{ PGStat Stat = TGStat::New(); Stat->AvgGStat(GStatV, ClipAt1); return Stat; }
const TGStatV& TGStatVec::GetGStatV | ( | ) | const [inline] |
int TGStatVec::GetTime | ( | const int & | ValN | ) | const [inline] |
TTmUnit TGStatVec::GetTmUnit | ( | ) | const [inline] |
void TGStatVec::GetValV | ( | const TGStatVal & | XVal, |
const TGStatVal & | YVal, | ||
TFltPrV & | ValV | ||
) | const |
bool TGStatVec::HasDistr | ( | const TGStatDistr & | Stat | ) | const [inline] |
bool TGStatVec::HasVal | ( | const TGStatVal & | Stat | ) | const [inline] |
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.
{ if (Desc.Empty()) Desc = FNmPref.GetUc(); if (! At(0)->HasDistr(Distr) || Distr==gsdUndef || Distr==gsdMx) { return; } TGStat::TPlotInfo Info = At(0)->GetPlotInfo(Distr); TGnuPlot GnuPlot(Info.Val1+TStr(".")+FNmPref, TStr::Fmt("%s. G(%d, %d) --> G(%d, %d)", Desc.CStr(), At(0)->GetNodes(), At(0)->GetEdges(), Last()->GetNodes(), Last()->GetEdges())); GnuPlot.SetXYLabel(Info.Val2, Info.Val3); GnuPlot.SetScale(Info.Val4); int plotId; for (int at = 0; at < Len(); at++) { TStr Legend = At(at)->GetNm(); if (Legend.Empty()) { Legend = At(at)->GetTmStr(); } if (! ExpBin) { plotId = GnuPlot.AddPlot(At(at)->GetDistr(Distr), PlotWith, Legend, Style); } else { TFltPrV ExpBinV; TGnuPlot::MakeExpBins(At(at)->GetDistr(Distr), ExpBinV, 2, 0); plotId = GnuPlot.AddPlot(ExpBinV, PlotWith, Legend, Style); } if (PowerFit) { GnuPlot.AddPwrFit(plotId, gpwLines); } } GnuPlot.SavePng(); }
PGStat TGStatVec::Last | ( | ) | const [inline] |
int TGStatVec::Len | ( | ) | const [inline] |
static PGStatVec TGStatVec::Load | ( | TSIn & | SIn | ) | [inline, static] |
PGStatVec TGStatVec::New | ( | const TTmUnit & | _TmUnit = tmu1Sec | ) | [static] |
PGStatVec TGStatVec::New | ( | const TTmUnit & | _TmUnit, |
const TFSet & | TakeGrowthStat | ||
) | [static] |
PGStat TGStatVec::operator[] | ( | const int & | ValN | ) | const [inline] |
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.
{ if (! Last()->HasVal(XVal) || ! Last()->HasVal(YVal)) { if (! Last()->HasVal(XVal)) { printf("** Does not have %s statistic\n", TGStat::GetValStr(XVal).CStr()); } if (! Last()->HasVal(YVal)) { printf("** Does not have %s statistic\n", TGStat::GetValStr(YVal).CStr()); } return; } if (Desc.Empty()) { Desc = OutFNm; } TFltPrV ValV; TGStatVec::GetValV(XVal, YVal, ValV); TGnuPlot GP(TStr::Fmt("%s-%s.%s", TGStat::GetValStr(XVal).CStr(), TGStat::GetValStr(YVal).CStr(), OutFNm.CStr()), TStr::Fmt("%s. %s vs. %s. G(%d,%d)", Desc.CStr(), TGStat::GetValStr(XVal).CStr(), TGStat::GetValStr(YVal).CStr(), Last()->GetNodes(), Last()->GetEdges())); GP.SetScale(Scale); GP.SetXYLabel(TGStat::GetValStr(XVal), TGStat::GetValStr(YVal)); const int Id = GP.AddPlot(ValV, gpwLinesPoints); if (PowerFit) { GP.AddPwrFit(Id); } GP.SavePng(); }
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.
{ const TFSet SkipStat = TFSet() | gsvFullDiamDev | gsvEffDiamDev | gsvEffWccDiamDev | gsvFullWccDiamDev; for (int stat = gsvNone; stat < gsvMx; stat++) { const TGStatVal Stat = TGStatVal(stat); if (SkipStat.In(Stat)) { continue; } if (Last()->HasVal(Stat) && Last()->HasVal(XVal) && Stat!=XVal) { Plot(XVal, Stat, OutFNm, Desc, Scale, PowerFit); } } }
void TGStatVec::Save | ( | TSOut & | SOut | ) | const |
void TGStatVec::SaveTxt | ( | const TStr & | FNmPref, |
const TStr & | Desc | ||
) | const |
Definition at line 584 of file gstat.cpp.
{ FILE *F = fopen(TStr::Fmt("growth.%s.tab", FNmPref.CStr()).CStr(), "wt"); fprintf(F, "# %s\n", Desc.CStr()); fprintf(F, "# %s", TTmInfo::GetTmUnitStr(TmUnit).CStr()); TIntSet StatValSet; for (int i = 0; i < Len(); i++) { for (int v = gsvNone; v < gsvMx; v++) { if (At(i)->HasVal(TGStatVal(v))) { StatValSet.AddKey(v); } } } TIntV StatValV; StatValSet.GetKeyV(StatValV); StatValV.Sort(); for (int sv = 0; sv < StatValV.Len(); sv++) { fprintf(F, "\t%s", TGStat::GetValStr(TGStatVal(StatValV[sv].Val)).CStr()); } fprintf(F, "Time\n"); for (int i = 0; i < Len(); i++) { const TGStat& G = *At(i); for (int sv = 0; sv < StatValV.Len(); sv++) { fprintf(F, "%g\t", G.GetVal(TGStatVal(StatValV[sv].Val))); } fprintf(F, "%s\n", G.GetTmStr().CStr()); } fclose(F); }
void TGStatVec::SetTakeStat | ( | const TFSet & | TakeStatSet | ) | [inline] |
void TGStatVec::SetTmUnit | ( | const TTmUnit & | TimeUnit | ) | [inline] |
void TGStatVec::Sort | ( | const TGStatVal & | SortBy = gsvNodes , |
const bool & | Asc = true |
||
) |
Definition at line 483 of file gstat.cpp.
{ GStatV.SortCmp(TGStat::TCmpByVal(SortBy, Asc)); }
TCRef TGStatVec::CRef [private] |
TGStatV TGStatVec::GStatV [private] |
uint TGStatVec::MinNodesEdges = 10 [static] |
TFSet TGStatVec::StatFSet [private] |
TTmUnit TGStatVec::TmUnit [private] |