1 #ifndef snap_cascnetinf_h
2 #define snap_cascnetinf_h
12 THitInfo(
const int& NodeId=-1,
const double& HitTime=0) : NId(NodeId), Parent(-1), Tm(HitTime) { }
26 TCascade() : NIdHitH(), CurProb(0), Alpha(1.0), Eps(1e-64), Model(0) { }
27 TCascade(
const double &alpha) : NIdHitH(), CurProb(0), Alpha(alpha), Eps(1e-64), Model(0) { }
28 TCascade(
const double &alpha,
const int &model) : NIdHitH(), CurProb(0), Alpha(alpha), Eps(1e-64), Model(model) { }
29 TCascade(
const double &alpha,
const double &eps) : NIdHitH(), CurProb(0), Alpha(alpha), Eps(eps), Model(0) { }
30 TCascade(
const double &alpha,
const int &model,
const double &eps) : NIdHitH(), CurProb(0), Alpha(alpha), Eps(eps), Model(model) { }
33 void Clr() { NIdHitH.
Clr(); CurProb = 0; Alpha = 1.0; }
34 int Len()
const {
return NIdHitH.
Len(); }
39 void Add(
const int& NId,
const double& HitTm) { NIdHitH.
AddDat(NId,
THitInfo(NId, HitTm)); }
41 bool IsNode(
const int& NId)
const {
return NIdHitH.
IsKey(NId); }
43 double TransProb(
const int& NId1,
const int& NId2)
const;
56 TNodeInfo(
const TStr& NodeNm,
const int& Volume) : Name(NodeNm), Vol(Volume) { }
72 const double& at) : Vol(v), MarginalGain(mg), MarginalBound(mb), MedianTimeDiff(mt), AverageTimeDiff(at) { }
76 const double& at) : Vol(v), MarginalGain(mg), MarginalBound(0), MedianTimeDiff(mt), AverageTimeDiff(at) { }
77 TEdgeInfo(
TSIn& SIn) : Vol(SIn), MarginalGain(SIn), MarginalBound(SIn), MedianTimeDiff(SIn), AverageTimeDiff(SIn) { }
78 void Save(
TSOut& SOut)
const { Vol.
Save(SOut); SOut.
Save(MarginalGain); SOut.
Save(MarginalBound); SOut.
Save(MedianTimeDiff); SOut.
Save(AverageTimeDiff); }
97 TNetInfBs( ) { BoundOn =
false; CompareGroundTruth=
false; }
98 TNetInfBs(
bool bo,
bool cgt) { BoundOn=bo; CompareGroundTruth=cgt; }
107 void AddCasc(
const TStr& CascStr,
const int& Model=0,
const double& alpha=1.0);
110 const double& std_waiting_time=0,
const double& std_beta=0);
122 TIntPr GetBestEdge(
double& CurProb,
double& LastGain,
bool& msort,
int &attempts);
void AddNodeNm(const int &NId, const TNodeInfo &Info)
void Save(TSOut &SOut) const
void AddGroundTruth(PNGraph >)
void Save(TSOut &SOut) const
THitInfo(const int &NodeId=-1, const double &HitTime=0)
TEdgeInfo(const int &v, const double &mg, const double &mt, const double &at)
void Save(TSOut &SOut) const
TNetInfBs(bool bo, bool cgt)
double GetProb(const PNGraph &G)
void LoadCascadesTxt(TSIn &SIn, const int &Model, const double &alpha)
int GetParent(const int NId) const
TSizeTy Len() const
Returns the number of elements in the vector.
double TransProb(const int &NId1, const int &NId2) const
TEdgeInfo(const int &v, const double &mg, const double &mb, const double &mt, const double &at)
void Save(TSOut &SOut) const
TNodeInfo(const TStr &NodeNm, const int &Volume)
int GetNodes() const
Returns the number of nodes in the graph.
void SavePlaneTextNet(const TStr &OutFNm)
THash< TInt, THitInfo > NIdHitH
const TDat & GetDat(const TKey &Key) const
void SaveObjInfo(const TStr &OutFNm)
bool operator<(const THitInfo &Hit) const
double UpdateProb(const int &N1, const int &N2, const bool &UpdateProb=false)
THash< TInt, TNodeInfo > NodeNmH
void Save(TSOut &SOut) const
THash< TIntPr, TIntV > CascPerEdge
void Save(TSOut &SOut) const
TCascade & GetCasc(int c)
void SaveEdgeInfo(const TStr &OutFNm)
double GetTm(const int &NId) const
void AddCasc(const TCascade &Cascade)
void DelKey(const TKey &Key)
TVec< TPair< TFlt, TIntPr > > EdgeGainV
TCascade(const double &alpha, const int &model)
void GreedyOpt(const int &MxEdges)
TStr GetNodeNm(const int &NId) const
void Save(TSOut &SOut, const bool &IsSmall=false) const
bool IsNodeNm(const int &NId) const
void SaveCascades(const TStr &OutFNm)
void Save(TSOut &SOut) const
void SavePajek(const TStr &OutFNm)
THash< TIntPr, TEdgeInfo > EdgeInfoH
void Save(const bool &Bool)
TNodeInfo GetNodeInfo(const int &NId) const
void GenCascade(TCascade &C, const int &TModel, const double &window, TIntPrIntH &EdgesUsed, const double &delta, const double &std_waiting_time=0, const double &std_beta=0)
void AddCasc(const TStr &CascStr, const int &Model=0, const double &alpha=1.0)
TCascade(const double &alpha)
void Add(const int &NId, const double &HitTm)
double GetAllCascProb(const int &EdgeN1, const int &EdgeN2)
TCascade(const double &alpha, const double &eps)
void Clr(const bool &DoDel=true, const int &NoDelLim=-1, const bool &ResetDat=true)
void LoadGroundTruthTxt(TSIn &SIn)
int GetNode(const int &i) const
void Save(TSOut &SOut) const
bool IsKey(const TKey &Key) const
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
TDat & AddDat(const TKey &Key)
double GetBound(const TIntPr &Edge, double &CurProb)
void Save(TSOut &SOut) const
const TKey & GetKey(const int &KeyId) const
bool IsNode(const int &NId) const
void SaveGroundTruth(const TStr &OutFNm)
TCascade(const double &alpha, const int &model, const double &eps)
void SortByDat(const bool &Asc=true)
TIntPr GetBestEdge(double &CurProb, double &LastGain, bool &msort, int &attempts)