SNAP Library 4.1, Developer Reference
2018-07-26 16:30:42
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <timenet.h>
Classes | |
class | TTmBucket |
Public Types | |
typedef TNodeNet< TSecTm > | TNet |
typedef TPt< TNodeNet< TSecTm > > | PNet |
typedef TVec< TTmBucket > | TTmBucketV |
Public Types inherited from TNodeNet< TSecTm > | |
typedef TSecTm | TNodeDat |
typedef TNodeNet< TSecTm > | TNet |
typedef TPt< TNet > | PNet |
Public Member Functions | |
TTimeNet () | |
TTimeNet (const int &Nodes, const int &Edges) | |
TTimeNet (const TTimeNet &TimeNet) | |
TTimeNet (TSIn &SIn) | |
void | Save (TSOut &SOut) const |
Saves the network to a (binary) stream SOut. More... | |
TTimeNet & | operator= (const TTimeNet &TimeNet) |
PTimeNet | GetSubGraph (const TIntV &NIdV) const |
PTimeNENet | GetTimeNENet () const |
void | GetNIdByTm (TIntV &NIdV) const |
void | GetTmBuckets (const TTmUnit &GroupBy, TTmBucketV &TmBucketV) const |
void | GetNodeBuckets (const int NodesPerBucket, TTimeNet::TTmBucketV &TmBucketV) const |
PGStatVec | TimeGrowth (const TTmUnit &TmUnit, const TFSet &TakeStat, const TSecTm &StartTm) const |
void | PlotEffDiam (const TStr &FNmPref, const TStr &Desc, const TTmUnit &GroupBy, const TSecTm &StartTm, const int &NDiamRuns=10, const bool &OnlyWcc=false, const bool &AlsoRewire=false) const |
void | PlotMissingPast (const TStr &FNmPref, const TStr &Desc, const TTmUnit &GroupBy, const TSecTm &DelPreTmEdges, const TSecTm &PostTmDiam) const |
void | PlotCCfOverTm (const TStr &FNmPref, TStr Desc, const TTmUnit &TmUnit, const int &NodesBucket=-1) const |
void | PlotMedianDegOverTm (const TStr &FNmPref, const TTmUnit &TmUnit, const int &NodesPerBucket=-1) const |
Public Member Functions inherited from TNodeNet< TSecTm > | |
const TNode & | GetNode (const int &NId) const |
Returns node element for the node of ID NId in the network. More... | |
TNodeNet () | |
TNodeNet (const int &Nodes, const int &Edges) | |
Constructor that reserves enough memory for a network of Nodes nodes and Edges edges. More... | |
TNodeNet (const TNodeNet &NodeNet) | |
TNodeNet (TSIn &SIn) | |
Constructor that loads the network from a (binary) stream SIn. More... | |
virtual | ~TNodeNet () |
bool | HasFlag (const TGraphFlag &Flag) const |
Allows for run-time checking the type of the network (see the TGraphFlag for flags). More... | |
TNodeNet & | operator= (const TNodeNet &NodeNet) |
int | GetNodes () const |
Returns the number of nodes in the network. More... | |
int | AddNode (int NId=-1) |
Adds a node of ID NId to the network. More... | |
int | AddNode (int NId, const TSecTm &NodeDat) |
Adds a node of ID NId and node data NodeDat to the network. More... | |
int | AddNode (const TNodeI &NodeI) |
Adds a node NodeI and its node data to the network. More... | |
int | AddNodeUnchecked (int NId=-1) |
Adds a node of ID NId to the network, noop if the node already exists. More... | |
virtual void | DelNode (const int &NId) |
Deletes node of ID NId from the network. More... | |
void | DelNode (const TNode &NodeI) |
Deletes node of ID NodeI.GetId() from the network. More... | |
bool | IsNode (const int &NId) const |
Tests whether ID NId is a node. More... | |
TNodeI | BegNI () const |
Returns an iterator referring to the first node in the network. More... | |
TNodeI | EndNI () const |
Returns an iterator referring to the past-the-end node in the network. More... | |
TNodeI | GetNI (const int &NId) const |
Returns an iterator referring to the node of ID NId in the network. More... | |
void | SetNDat (const int &NId, const TSecTm &NodeDat) |
Sets node data for the node of ID NId in the network. More... | |
TSecTm & | GetNDat (const int &NId) |
Returns node data for the node of ID NId in the network. More... | |
const TSecTm & | GetNDat (const int &NId) const |
Returns node data for the node of ID NId in the network. More... | |
int | GetMxNId () const |
Returns an ID that is larger than any node ID in the network. More... | |
int | GetEdges () const |
Returns the number of edges in the network. More... | |
int | AddEdge (const int &SrcNId, const int &DstNId) |
Adds an edge from node SrcNId to node DstNId to the network. More... | |
int | AddEdge (const TEdgeI &EdgeI) |
Adds an edge from EdgeI.GetSrcNId() to EdgeI.GetDstNId() to the network. More... | |
void | DelEdge (const int &SrcNId, const int &DstNId, const bool &IsDir=true) |
Deletes an edge from node IDs SrcNId to DstNId from the network. More... | |
bool | IsEdge (const int &SrcNId, const int &DstNId, const bool &IsDir=true) const |
Tests whether an edge from node IDs SrcNId to DstNId exists in the network. More... | |
TEdgeI | BegEI () const |
Returns an iterator referring to the first edge in the network. More... | |
TEdgeI | EndEI () const |
Returns an iterator referring to the past-the-end edge in the network. More... | |
TEdgeI | GetEI (const int &EId) const |
Not supported/implemented! More... | |
TEdgeI | GetEI (const int &SrcNId, const int &DstNId) const |
Returns an iterator referring to edge (SrcNId, DstNId) in the network. More... | |
int | GetRndNId (TRnd &Rnd=TInt::Rnd) |
Returns an ID of a random node in the network. More... | |
TNodeI | GetRndNI (TRnd &Rnd=TInt::Rnd) |
Returns an interator referring to a random node in the network. More... | |
void | GetNIdV (TIntV &NIdV) const |
Gets a vector IDs of all nodes in the network. More... | |
bool | Empty () const |
Tests whether the network is empty (has zero nodes). More... | |
void | Clr (const bool &DoDel=true, const bool &ResetDat=true) |
Deletes all nodes and edges from the network. More... | |
void | Reserve (const int &Nodes, const int &Edges) |
Reserves memory for a network of Nodes nodes and Edges edges. More... | |
void | SortNIdById (const bool &Asc=true) |
Sorts nodes by node IDs. More... | |
void | SortNIdByDat (const bool &Asc=true) |
Sorts nodes by node data. More... | |
void | Defrag (const bool &OnlyNodeLinks=false) |
Defragments the network. More... | |
bool | IsOk (const bool &ThrowExcept=true) const |
Checks the network data structure for internal consistency. More... | |
Static Public Member Functions | |
static PTimeNet | New () |
static PTimeNet | New (const int &Nodes, const int &Edges) |
static PTimeNet | Load (TSIn &SIn) |
static PTimeNet | LoadBipartite (const TStr &InFNm) |
static PTimeNet | LoadArxiv (const TStr &PaperFNm, const TStr &CiteFNm) |
static PTimeNet | LoadPatents (const TStr &PatentFNm, const TStr &CiteFNm) |
static PTimeNet | LoadAmazon (const TStr &StlFNm) |
Static Public Member Functions inherited from TNodeNet< TSecTm > | |
static PNet | New () |
Static constructor that returns a pointer to the network. Call: TPt <TNodeNet<TNodeData> > Net = TNodeNet<TNodeData>::New(). More... | |
static PNet | Load (TSIn &SIn) |
Static constructor that loads the network from a stream SIn and returns a pointer to it. More... | |
static PNet | LoadShM (TShMIn &ShMIn) |
Static constructor that loads the network from shared memory. More... | |
Friends | |
class | TPt< TTimeNet > |
Additional Inherited Members | |
Protected Member Functions inherited from TNodeNet< TSecTm > | |
TNode & | GetNode (const int &NId) |
Protected Attributes inherited from TNodeNet< TSecTm > | |
TCRef | CRef |
TInt | MxNId |
THash< TInt, TNode > | NodeH |
typedef TNodeNet<TSecTm> TTimeNet::TNet |
typedef TVec<TTmBucket> TTimeNet::TTmBucketV |
|
inline |
|
inline |
void TTimeNet::GetNIdByTm | ( | TIntV & | NIdV | ) | const |
Definition at line 48 of file timenet.cpp.
References TVec< TVal, TSizeTy >::Add(), TNodeNet< TSecTm >::BegNI(), TNodeNet< TSecTm >::EndNI(), TVec< TVal, TSizeTy >::Gen(), TNodeNet< TSecTm >::GetNodes(), TVec< TVal, TSizeTy >::Len(), and TVec< TVal, TSizeTy >::Sort().
Referenced by GetNodeBuckets(), and GetTimeNENet().
void TTimeNet::GetNodeBuckets | ( | const int | NodesPerBucket, |
TTimeNet::TTmBucketV & | TmBucketV | ||
) | const |
Definition at line 77 of file timenet.cpp.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Gen(), GetNIdByTm(), and TVec< TVal, TSizeTy >::Len().
Referenced by PlotCCfOverTm(), and PlotMedianDegOverTm().
Definition at line 10 of file timenet.cpp.
References TNodeNet< TNodeData >::AddEdge(), TNodeNet< TNodeData >::AddNode(), TNodeNet< TNodeData >::Defrag(), edge, TNodeNet< TSecTm >::GetNDat(), TNodeNet< TSecTm >::GetNI(), TNodeNet< TNodeData >::IsNode(), TVec< TVal, TSizeTy >::Len(), New(), and TNodeNet< TNodeData >::Reserve().
PTimeNENet TTimeNet::GetTimeNENet | ( | ) | const |
Definition at line 32 of file timenet.cpp.
References TNodeNet< TSecTm >::GetEdges(), TNodeNet< TSecTm >::GetNI(), GetNIdByTm(), TNodeNet< TSecTm >::GetNodes(), TVec< TVal, TSizeTy >::Len(), and TTimeNENet::New().
void TTimeNet::GetTmBuckets | ( | const TTmUnit & | GroupBy, |
TTmBucketV & | TmBucketV | ||
) | const |
Definition at line 59 of file timenet.cpp.
References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddKey(), TNodeNet< TSecTm >::BegNI(), TTimeNet::TTmBucket::BegTm, TNodeNet< TSecTm >::EndNI(), TVec< TVal, TSizeTy >::Gen(), THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetKeyDatPrV(), THash< TKey, TDat, THashFunc >::IsKey(), TVec< TVal, TSizeTy >::Len(), TTimeNet::TTmBucket::NIdV, and TVec< TVal, TSizeTy >::Sort().
Referenced by PlotCCfOverTm(), PlotEffDiam(), PlotMedianDegOverTm(), PlotMissingPast(), and TimeGrowth().
Definition at line 41 of file timenet.h.
References TTimeNet().
Definition at line 563 of file timenet.cpp.
References TNodeNet< TNodeData >::AddEdge(), TNodeNet< TNodeData >::AddNode(), TStr::CStr(), TNodeNet< TNodeData >::Defrag(), TNodeNet< TNodeData >::GetEdges(), TStr::GetInt(), TTmInfo::GetMonthN(), TNodeNet< TNodeData >::GetNodes(), TStr::GetSubStr(), TNodeNet< TNodeData >::IsEdge(), TNodeNet< TNodeData >::IsNode(), lUs, New(), TNodeNet< TNodeData >::Reserve(), and TStr::SplitOnAllCh().
Definition at line 383 of file timenet.cpp.
References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), TNodeNet< TNodeData >::AddEdge(), TNodeNet< TNodeData >::AddNode(), TNodeNet< TNodeData >::BegNI(), TSnap::CntDegNodes(), TStr::CStr(), TNodeNet< TNodeData >::Defrag(), TNodeNet< TNodeData >::DelNode(), TNodeNet< TNodeData >::EndNI(), THash< TKey, TDat, THashFunc >::GetDat(), TNodeNet< TNodeData >::GetEdges(), THash< TKey, TDat, THashFunc >::GetKey(), TNodeNet< TNodeData >::GetNDat(), TNodeNet< TNodeData >::GetNodes(), TExeTm::GetTmStr(), IAssert, TNodeNet< TNodeData >::IsEdge(), THash< TKey, TDat, THashFunc >::IsKey(), TNodeNet< TNodeData >::IsNode(), THash< TKey, TDat, THashFunc >::Len(), TVec< TVal, TSizeTy >::Len(), New(), TStr::SplitOnWs(), and TExeTm::Tick().
Definition at line 346 of file timenet.cpp.
References TNodeNet< TNodeData >::AddEdge(), TNodeNet< TNodeData >::AddNode(), TSnap::CntInDegNodes(), TSnap::CntOutDegNodes(), TStr::CStr(), TNodeNet< TNodeData >::Defrag(), TNodeNet< TNodeData >::GetEdges(), TNodeNet< TNodeData >::GetNDat(), TNodeNet< TNodeData >::GetNodes(), IAssert, TNodeNet< TNodeData >::IsEdge(), TNodeNet< TNodeData >::IsNode(), TSs::LoadTxt(), TMath::Mn(), New(), and ssfTabSep.
Definition at line 480 of file timenet.cpp.
References TVec< TVal, TSizeTy >::Add(), TNodeNet< TNodeData >::AddEdge(), TNodeNet< TNodeData >::AddNode(), TNodeNet< TNodeData >::BegNI(), TSnap::CntDegNodes(), TStr::CStr(), TNodeNet< TNodeData >::Defrag(), TNodeNet< TNodeData >::DelNode(), TNodeNet< TNodeData >::EndNI(), TNodeNet< TNodeData >::GetEdges(), TStr::GetInt(), TNodeNet< TNodeData >::GetNDat(), TNodeNet< TNodeData >::GetNodes(), TExeTm::GetTmStr(), IAssert, TNodeNet< TNodeData >::IsEdge(), TNodeNet< TNodeData >::IsNode(), TVec< TVal, TSizeTy >::Len(), New(), TNodeNet< TNodeData >::Reserve(), TStr::SplitOnAllCh(), TStr::SplitOnCh(), and TExeTm::Tick().
|
inlinestatic |
Definition at line 39 of file timenet.h.
References TTimeNet().
Referenced by GetSubGraph(), TTimeNENet::GetTimeNet(), LoadAmazon(), LoadArxiv(), LoadBipartite(), and LoadPatents().
|
inlinestatic |
Definition at line 40 of file timenet.h.
References TTimeNet().
Definition at line 3 of file timenet.cpp.
References TNodeNet< TSecTm >::operator=().
void TTimeNet::PlotCCfOverTm | ( | const TStr & | FNmPref, |
TStr | Desc, | ||
const TTmUnit & | TmUnit, | ||
const int & | NodesBucket = -1 |
||
) | const |
Definition at line 253 of file timenet.cpp.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::AddV(), TStr::CStr(), TStr::Empty(), TStr::Fmt(), TSnap::GetClustCf(), TNodeNet< TSecTm >::GetEdges(), TUNGraph::GetEdges(), GetNodeBuckets(), TUNGraph::GetNodes(), TExeTm::GetStr(), TSnap::GetSubGraph(), GetTmBuckets(), TTmInfo::GetTmUnitStr(), gpsAuto, gpsLog10XY, IAssert, TVec< TVal, TSizeTy >::Len(), TGnuPlot::PlotValV(), TGnuPlot::SaveTs(), and tmuNodes.
void TTimeNet::PlotEffDiam | ( | const TStr & | FNmPref, |
const TStr & | Desc, | ||
const TTmUnit & | GroupBy, | ||
const TSecTm & | StartTm, | ||
const int & | NDiamRuns = 10 , |
||
const bool & | OnlyWcc = false , |
||
const bool & | AlsoRewire = false |
||
) | const |
Definition at line 106 of file timenet.cpp.
References TMom::Add(), TVec< TVal, TSizeTy >::Add(), TGnuPlot::AddErrBar(), TVec< TVal, TSizeTy >::AddV(), TUNGraph::BegNI(), TStr::CStr(), TMom::Def(), TVec< TVal, TSizeTy >::Empty(), TUNGraph::EndNI(), TStr::Fmt(), TSnap::GenConfModel(), TSnap::GetAnfEffDiam(), TNodeNet< TSecTm >::GetEdges(), TUNGraph::GetEdges(), TMom::GetMean(), TSnap::GetMxWcc(), TNodeNet< TSecTm >::GetNodes(), TUNGraph::GetNodes(), TStr::GetNullStr(), TMom::GetSDev(), GetTmBuckets(), TExeTm::GetTmStr(), TTmInfo::GetTmUnitStr(), TVec< TVal, TSizeTy >::Len(), TInt::Rnd, TGnuPlot::SavePng(), TGnuPlot::SetXYLabel(), TVec< TVal, TSizeTy >::Sort(), and TExeTm::Tick().
void TTimeNet::PlotMedianDegOverTm | ( | const TStr & | FNmPref, |
const TTmUnit & | TmUnit, | ||
const int & | NodesPerBucket = -1 |
||
) | const |
Definition at line 302 of file timenet.cpp.
References TMom::Add(), TVec< TVal, TSizeTy >::AddV(), TUNGraph::BegNI(), TNGraph::BegNI(), TSnap::CntNonZNodes(), TStr::CStr(), TMom::Def(), TUNGraph::EndNI(), TNGraph::EndNI(), TStr::Fmt(), TNodeNet< TSecTm >::GetEdges(), TUNGraph::GetEdges(), TNGraph::GetEdges(), TMom::GetMean(), TMom::GetMedian(), GetNodeBuckets(), TUNGraph::GetNodes(), TNGraph::GetNodes(), TSnap::GetSubGraph(), GetTmBuckets(), TTmInfo::GetTmUnitStr(), IAssert, TVec< TVal, TSizeTy >::Len(), TGnuPlot::PlotValV(), and tmuNodes.
void TTimeNet::PlotMissingPast | ( | const TStr & | FNmPref, |
const TStr & | Desc, | ||
const TTmUnit & | GroupBy, | ||
const TSecTm & | DelPreTmEdges, | ||
const TSecTm & | PostTmDiam | ||
) | const |
Definition at line 169 of file timenet.cpp.
References TMom::Add(), TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::AddV(), TNodeNet< TSecTm >::BegNI(), TUNGraph::BegNI(), TStr::CStr(), TMom::Def(), TUNGraph::Defrag(), TUNGraph::DelEdge(), edge, TVec< TVal, TSizeTy >::Empty(), TNodeNet< TSecTm >::EndNI(), TUNGraph::EndNI(), TStr::Fmt(), TSnap::GetBfsEffDiam(), TExeTm::GetCurTm(), TMom::GetMean(), TSnap::GetMxWcc(), TNodeNet< TSecTm >::GetNDat(), TMom::GetSDev(), TSecTm::GetStr(), TSnap::GetSubGraph(), GetTmBuckets(), TExeTm::GetTmStr(), TTmInfo::GetTmUnitStr(), gsvEffDiam, gsvEffDiamDev, gsvEffWccDiam, gsvEffWccDiamDev, gsvFullDiam, gsvFullDiamDev, gsvFullWccDiam, gsvFullWccDiamDev, TSecTm::IsDef(), TUNGraph::IsNode(), TVec< TVal, TSizeTy >::Len(), TGStatVec::New(), TPt< TRec >::Save(), TGStat::SetVal(), TGStat::TakeBasicStat(), and TExeTm::Tick().
|
inlinevirtual |
Saves the network to a (binary) stream SOut.
Reimplemented from TNodeNet< TSecTm >.
Definition at line 38 of file timenet.h.
References TNodeNet< TSecTm >::Save().
PGStatVec TTimeNet::TimeGrowth | ( | const TTmUnit & | TmUnit, |
const TFSet & | TakeStat, | ||
const TSecTm & | StartTm | ||
) | const |
Definition at line 88 of file timenet.cpp.
References TVec< TVal, TSizeTy >::AddV(), GetTmBuckets(), TVec< TVal, TSizeTy >::Len(), and TExeTm::Tick().