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

#include <cascdynetinf.h>

Collaboration diagram for TCascade:

Public Member Functions

 TCascade ()
 
 TCascade (const int &model)
 
 TCascade (const int &cid, const int &model)
 
 TCascade (TSIn &SIn)
 
void Save (TSOut &SOut) const
 
void Clr ()
 
int GetId ()
 
int Len () const
 
int LenBeforeT (const double &T)
 
int LenAfterT (const double &T)
 
int GetNode (const int &i) const
 
THash< TInt, THitInfo >::TIter BegI () const
 
THash< TInt, THitInfo >::TIter EndI () const
 
int GetModel () const
 
double GetTm (const int &NId) const
 
double GetMaxTm () const
 
double GetMinTm () const
 
void Add (const int &NId, const double &HitTm)
 
void Del (const int &NId)
 
bool IsNode (const int &NId) const
 
void Sort ()
 
bool operator< (const TCascade &Cascade) const
 
 TCascade ()
 
 TCascade (const double &alpha)
 
 TCascade (const double &alpha, const int &model)
 
 TCascade (const double &alpha, const double &eps)
 
 TCascade (const double &alpha, const int &model, const double &eps)
 
 TCascade (TSIn &SIn)
 
void Save (TSOut &SOut) const
 
void Clr ()
 
int Len () const
 
int GetNode (const int &i) const
 
int GetParent (const int NId) const
 
double GetAlpha () const
 
double GetTm (const int &NId) const
 
void Add (const int &NId, const double &HitTm)
 
void Del (const int &NId)
 
bool IsNode (const int &NId) const
 
void Sort ()
 
double TransProb (const int &NId1, const int &NId2) const
 
double GetProb (const PNGraph &G)
 
void InitProb ()
 
double UpdateProb (const int &N1, const int &N2, const bool &UpdateProb=false)
 

Public Attributes

TInt CId
 
THash< TInt, THitInfoNIdHitH
 
TInt Model
 
TFlt CurProb
 
TFlt Alpha
 
TFlt Eps
 

Detailed Description

Definition at line 84 of file cascdynetinf.h.

Constructor & Destructor Documentation

TCascade::TCascade ( )
inline

Definition at line 90 of file cascdynetinf.h.

90 : CId(0), NIdHitH(), Model(0) { }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
TInt Model
Definition: cascdynetinf.h:88
TInt CId
Definition: cascdynetinf.h:86
TCascade::TCascade ( const int &  model)
inline

Definition at line 91 of file cascdynetinf.h.

References Model.

91 : NIdHitH() { Model = model; }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
TInt Model
Definition: cascdynetinf.h:88
TCascade::TCascade ( const int &  cid,
const int &  model 
)
inline

Definition at line 92 of file cascdynetinf.h.

References CId, and Model.

92 : NIdHitH() { CId = cid; Model = model; }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
TInt Model
Definition: cascdynetinf.h:88
TInt CId
Definition: cascdynetinf.h:86
TCascade::TCascade ( TSIn SIn)
inline

Definition at line 93 of file cascdynetinf.h.

93 : CId(SIn), NIdHitH(SIn), Model(SIn) { }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
TInt Model
Definition: cascdynetinf.h:88
TInt CId
Definition: cascdynetinf.h:86
TCascade::TCascade ( )
inline

Definition at line 26 of file cascnetinf.h.

26 : NIdHitH(), CurProb(0), Alpha(1.0), Eps(1e-64), Model(0) { }
TFlt Eps
Definition: cascnetinf.h:23
TFlt CurProb
Definition: cascnetinf.h:23
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
TInt Model
Definition: cascdynetinf.h:88
TFlt Alpha
Definition: cascnetinf.h:23
TCascade::TCascade ( const double &  alpha)
inline

Definition at line 27 of file cascnetinf.h.

27 : NIdHitH(), CurProb(0), Alpha(alpha), Eps(1e-64), Model(0) { }
TFlt Eps
Definition: cascnetinf.h:23
TFlt CurProb
Definition: cascnetinf.h:23
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
TInt Model
Definition: cascdynetinf.h:88
TFlt Alpha
Definition: cascnetinf.h:23
TCascade::TCascade ( const double &  alpha,
const int &  model 
)
inline

Definition at line 28 of file cascnetinf.h.

28 : NIdHitH(), CurProb(0), Alpha(alpha), Eps(1e-64), Model(model) { }
TFlt Eps
Definition: cascnetinf.h:23
TFlt CurProb
Definition: cascnetinf.h:23
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
TInt Model
Definition: cascdynetinf.h:88
TFlt Alpha
Definition: cascnetinf.h:23
TCascade::TCascade ( const double &  alpha,
const double &  eps 
)
inline

Definition at line 29 of file cascnetinf.h.

29 : NIdHitH(), CurProb(0), Alpha(alpha), Eps(eps), Model(0) { }
TFlt Eps
Definition: cascnetinf.h:23
TFlt CurProb
Definition: cascnetinf.h:23
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
TInt Model
Definition: cascdynetinf.h:88
TFlt Alpha
Definition: cascnetinf.h:23
TCascade::TCascade ( const double &  alpha,
const int &  model,
const double &  eps 
)
inline

Definition at line 30 of file cascnetinf.h.

30 : NIdHitH(), CurProb(0), Alpha(alpha), Eps(eps), Model(model) { }
TFlt Eps
Definition: cascnetinf.h:23
TFlt CurProb
Definition: cascnetinf.h:23
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
TInt Model
Definition: cascdynetinf.h:88
TFlt Alpha
Definition: cascnetinf.h:23
TCascade::TCascade ( TSIn SIn)
inline

Definition at line 31 of file cascnetinf.h.

31 : NIdHitH(SIn), CurProb(SIn), Alpha(SIn) { }
TFlt CurProb
Definition: cascnetinf.h:23
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
TFlt Alpha
Definition: cascnetinf.h:23

Member Function Documentation

void TCascade::Add ( const int &  NId,
const double &  HitTm 
)
inline

Definition at line 39 of file cascnetinf.h.

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

39 { NIdHitH.AddDat(NId, THitInfo(NId, HitTm)); }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
TDat & AddDat(const TKey &Key)
Definition: hash.h:238

Here is the call graph for this function:

void TCascade::Add ( const int &  NId,
const double &  HitTm 
)
inline

Definition at line 107 of file cascdynetinf.h.

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

Referenced by TNetInfBs::AddCasc(), TNIBs::AddCasc(), TNetInfBs::GenCascade(), and TNIBs::GenCascade().

107 { NIdHitH.AddDat(NId, THitInfo(NId, HitTm)); }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
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:

THash<TInt, THitInfo>::TIter TCascade::BegI ( ) const
inline

Definition at line 101 of file cascdynetinf.h.

References THash< TKey, TDat, THashFunc >::BegI(), and NIdHitH.

Referenced by TNIBs::UpdateDiff().

101 { return NIdHitH.BegI(); }
TIter BegI() const
Definition: hash.h:213
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87

Here is the call graph for this function:

Here is the caller graph for this function:

void TCascade::Clr ( )
inline

Definition at line 33 of file cascnetinf.h.

References Alpha, THash< TKey, TDat, THashFunc >::Clr(), CurProb, and NIdHitH.

33 { NIdHitH.Clr(); CurProb = 0; Alpha = 1.0; }
TFlt CurProb
Definition: cascnetinf.h:23
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
TFlt Alpha
Definition: cascnetinf.h:23
void Clr(const bool &DoDel=true, const int &NoDelLim=-1, const bool &ResetDat=true)
Definition: hash.h:361

Here is the call graph for this function:

void TCascade::Clr ( )
inline

Definition at line 95 of file cascdynetinf.h.

References THash< TKey, TDat, THashFunc >::Clr(), and NIdHitH.

Referenced by TNetInfBs::GenCascade(), and TNIBs::GenCascade().

95 { NIdHitH.Clr(); }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
void Clr(const bool &DoDel=true, const int &NoDelLim=-1, const bool &ResetDat=true)
Definition: hash.h:361

Here is the call graph for this function:

Here is the caller graph for this function:

void TCascade::Del ( const int &  NId)
inline

Definition at line 40 of file cascnetinf.h.

References THash< TKey, TDat, THashFunc >::DelKey(), and NIdHitH.

40 { NIdHitH.DelKey(NId); }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
void DelKey(const TKey &Key)
Definition: hash.h:404

Here is the call graph for this function:

void TCascade::Del ( const int &  NId)
inline

Definition at line 108 of file cascdynetinf.h.

References THash< TKey, TDat, THashFunc >::DelKey(), and NIdHitH.

108 { NIdHitH.DelKey(NId); }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
void DelKey(const TKey &Key)
Definition: hash.h:404

Here is the call graph for this function:

THash<TInt, THitInfo>::TIter TCascade::EndI ( ) const
inline

Definition at line 102 of file cascdynetinf.h.

References THash< TKey, TDat, THashFunc >::EndI(), and NIdHitH.

Referenced by TNIBs::UpdateDiff().

102 { return NIdHitH.EndI(); }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
TIter EndI() const
Definition: hash.h:218

Here is the call graph for this function:

Here is the caller graph for this function:

double TCascade::GetAlpha ( ) const
inline

Definition at line 37 of file cascnetinf.h.

References Alpha.

37 { return Alpha; }
TFlt Alpha
Definition: cascnetinf.h:23
int TCascade::GetId ( )
inline

Definition at line 96 of file cascdynetinf.h.

References CId.

96 { return CId; }
TInt CId
Definition: cascdynetinf.h:86
double TCascade::GetMaxTm ( ) const
inline

Definition at line 105 of file cascdynetinf.h.

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

105 { return NIdHitH[NIdHitH.Len()-1].Tm; } // we assume the cascade is sorted
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
int Len() const
Definition: hash.h:228

Here is the call graph for this function:

double TCascade::GetMinTm ( ) const
inline

Definition at line 106 of file cascdynetinf.h.

References NIdHitH.

Referenced by TNIBs::UpdateDiff().

106 { return NIdHitH[0].Tm; } // we assume the cascade is sorted
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87

Here is the caller graph for this function:

int TCascade::GetModel ( ) const
inline

Definition at line 103 of file cascdynetinf.h.

References Model.

103 { return Model; }
TInt Model
Definition: cascdynetinf.h:88
int TCascade::GetNode ( const int &  i) const
inline

Definition at line 35 of file cascnetinf.h.

References THash< TKey, TDat, THashFunc >::GetKey(), and NIdHitH.

35 { return NIdHitH.GetKey(i); }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:252

Here is the call graph for this function:

int TCascade::GetNode ( const int &  i) const
inline

Definition at line 100 of file cascdynetinf.h.

References THash< TKey, TDat, THashFunc >::GetKey(), and NIdHitH.

Referenced by GetProb().

100 { return NIdHitH.GetKey(i); }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:252

Here is the call graph for this function:

Here is the caller graph for this function:

int TCascade::GetParent ( const int  NId) const
inline

Definition at line 36 of file cascnetinf.h.

References THash< TKey, TDat, THashFunc >::GetDat(), NIdHitH, and THitInfo::Parent.

Referenced by UpdateProb().

36 { return NIdHitH.GetDat(NId).Parent; }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TInt Parent
Definition: cascnetinf.h:9

Here is the call graph for this function:

Here is the caller graph for this function:

double TCascade::GetProb ( const PNGraph G)

Definition at line 17 of file cascnetinf.cpp.

References Eps, THash< TKey, TDat, THashFunc >::GetDat(), TNGraph::TNodeI::GetInDeg(), TNGraph::TNodeI::GetInNId(), TNGraph::GetNI(), GetNode(), GetTm(), IsNode(), Len(), NIdHitH, THitInfo::Parent, and TransProb().

17  {
18  double P = 0;
19  for (int n = 0; n < Len(); n++) {
20  const int DstNId = GetNode(n);
21  const double DstTm = GetTm(DstNId);
22  TNGraph::TNodeI NI = G->GetNI(DstNId);
23  double MxProb = log(Eps);
24  int BestParent = -1;
25  for (int e = 0; e < NI.GetInDeg(); e++) {
26  const int SrcNId = NI.GetInNId(e);
27  if (IsNode(SrcNId) && GetTm(SrcNId) < DstTm) {
28  const double Prob = log(TransProb(SrcNId, DstNId));
29  if (MxProb < Prob) { MxProb = Prob; BestParent = SrcNId; }
30  }
31  }
32  NIdHitH.GetDat(DstNId).Parent = BestParent;
33  P += MxProb;
34  }
35 
36  return P;
37 }
TFlt Eps
Definition: cascnetinf.h:23
TNodeI GetNI(const int &NId) const
Returns an iterator referring to the node of ID NId in the graph.
Definition: graph.h:548
int Len() const
Definition: cascdynetinf.h:97
double TransProb(const int &NId1, const int &NId2) const
Definition: cascnetinf.cpp:4
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
double GetTm(const int &NId) const
Definition: cascdynetinf.h:104
TInt Parent
Definition: cascnetinf.h:9
Node iterator. Only forward iteration (operator++) is supported.
Definition: graph.h:379
int GetNode(const int &i) const
Definition: cascdynetinf.h:100
int GetInDeg() const
Returns in-degree of the current node.
Definition: graph.h:400
int GetInNId(const int &NodeN) const
Returns ID of NodeN-th in-node (the node pointing to the current node).
Definition: graph.h:408
bool IsNode(const int &NId) const
Definition: cascdynetinf.h:109

Here is the call graph for this function:

double TCascade::GetTm ( const int &  NId) const
inline

Definition at line 38 of file cascnetinf.h.

References THash< TKey, TDat, THashFunc >::GetDat(), NIdHitH, and THitInfo::Tm.

38 { return NIdHitH.GetDat(NId).Tm; }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262

Here is the call graph for this function:

double TCascade::GetTm ( const int &  NId) const
inline

Definition at line 104 of file cascdynetinf.h.

References THash< TKey, TDat, THashFunc >::GetDat(), NIdHitH, and THitInfo::Tm.

Referenced by GetProb(), TransProb(), TNIBs::UpdateDiff(), and UpdateProb().

104 { return NIdHitH.GetDat(NId).Tm; }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262

Here is the call graph for this function:

Here is the caller graph for this function:

void TCascade::InitProb ( )

Definition at line 40 of file cascnetinf.cpp.

References CurProb, Eps, Len(), and NIdHitH.

40  {
41  CurProb = log(Eps) * Len();
42  for (int i = 0; i < Len(); i++) {
43  NIdHitH[i].Parent = -1; }
44 }
TFlt Eps
Definition: cascnetinf.h:23
TFlt CurProb
Definition: cascnetinf.h:23
int Len() const
Definition: cascdynetinf.h:97
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87

Here is the call graph for this function:

bool TCascade::IsNode ( const int &  NId) const
inline

Definition at line 41 of file cascnetinf.h.

References THash< TKey, TDat, THashFunc >::IsKey(), and NIdHitH.

41 { return NIdHitH.IsKey(NId); }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
bool IsKey(const TKey &Key) const
Definition: hash.h:258

Here is the call graph for this function:

bool TCascade::IsNode ( const int &  NId) const
inline

Definition at line 109 of file cascdynetinf.h.

References THash< TKey, TDat, THashFunc >::IsKey(), and NIdHitH.

Referenced by GetProb(), TransProb(), TNIBs::UpdateDiff(), and UpdateProb().

109 { return NIdHitH.IsKey(NId); }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
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 TCascade::Len ( ) const
inline

Definition at line 34 of file cascnetinf.h.

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

34 { return NIdHitH.Len(); }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
int Len() const
Definition: hash.h:228

Here is the call graph for this function:

int TCascade::Len ( ) const
inline

Definition at line 97 of file cascdynetinf.h.

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

Referenced by TNetInfBs::GenCascade(), TNIBs::GenCascade(), GetProb(), InitProb(), operator<(), and TNetInfBs::SaveCascades().

97 { return NIdHitH.Len(); }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
int Len() const
Definition: hash.h:228

Here is the call graph for this function:

Here is the caller graph for this function:

int TCascade::LenAfterT ( const double &  T)
inline

Definition at line 99 of file cascdynetinf.h.

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

99 { int len = 0; while (len < NIdHitH.Len() && NIdHitH[NIdHitH.Len()-1-len].Tm >= T) { len++; } return len; }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
int Len() const
Definition: hash.h:228

Here is the call graph for this function:

int TCascade::LenBeforeT ( const double &  T)
inline

Definition at line 98 of file cascdynetinf.h.

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

98 { int len = 0; while (len < NIdHitH.Len() && NIdHitH[len].Tm <= T) { len++; } return len; }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
int Len() const
Definition: hash.h:228

Here is the call graph for this function:

bool TCascade::operator< ( const TCascade Cascade) const
inline

Definition at line 111 of file cascdynetinf.h.

References Len().

111  {
112  return Len() < Cascade.Len(); }
int Len() const
Definition: cascdynetinf.h:97

Here is the call graph for this function:

void TCascade::Save ( TSOut SOut) const
inline

Definition at line 32 of file cascnetinf.h.

References Alpha, CurProb, NIdHitH, THash< TKey, TDat, THashFunc >::Save(), and TFlt::Save().

32 { NIdHitH.Save(SOut); CurProb.Save(SOut); Alpha.Save(SOut); }
TFlt CurProb
Definition: cascnetinf.h:23
void Save(TSOut &SOut) const
Definition: hash.h:183
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
TFlt Alpha
Definition: cascnetinf.h:23
void Save(TSOut &SOut) const
Definition: dt.h:1399

Here is the call graph for this function:

void TCascade::Save ( TSOut SOut) const
inline

Definition at line 94 of file cascdynetinf.h.

References CId, Model, NIdHitH, THash< TKey, TDat, THashFunc >::Save(), and TInt::Save().

94 { CId.Save(SOut); NIdHitH.Save(SOut); Model.Save(SOut); }
void Save(TSOut &SOut) const
Definition: dt.h:1150
void Save(TSOut &SOut) const
Definition: hash.h:183
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
TInt Model
Definition: cascdynetinf.h:88
TInt CId
Definition: cascdynetinf.h:86

Here is the call graph for this function:

void TCascade::Sort ( )
inline

Definition at line 42 of file cascnetinf.h.

References NIdHitH, and THash< TKey, TDat, THashFunc >::SortByDat().

42 { NIdHitH.SortByDat(true); }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
void SortByDat(const bool &Asc=true)
Definition: hash.h:292

Here is the call graph for this function:

void TCascade::Sort ( )
inline

Definition at line 110 of file cascdynetinf.h.

References NIdHitH, and THash< TKey, TDat, THashFunc >::SortByDat().

Referenced by TNetInfBs::AddCasc(), TNIBs::AddCasc(), TNetInfBs::GenCascade(), and TNIBs::GenCascade().

110 { NIdHitH.SortByDat(true); }
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
void SortByDat(const bool &Asc=true)
Definition: hash.h:292

Here is the call graph for this function:

Here is the caller graph for this function:

double TCascade::TransProb ( const int &  NId1,
const int &  NId2 
) const

Definition at line 4 of file cascnetinf.cpp.

References Alpha, Eps, GetTm(), IsNode(), Model, and TFlt::Val.

Referenced by GetProb(), and UpdateProb().

4  {
5  if (!IsNode(NId1) || !IsNode(NId2)) { return Eps.Val; }
6  if (GetTm(NId1) >= GetTm(NId2)) { return Eps.Val; }
7  if (Model==0)
8  return Alpha*exp(-Alpha*(GetTm(NId2)-GetTm(NId1))); // exponential
9  else if (Model==1)
10  return (Alpha-1)*pow((GetTm(NId2)-GetTm(NId1)), -Alpha); // power-law
11  else
12  return Alpha*(GetTm(NId2)-GetTm(NId1))*exp(-0.5*Alpha*pow(GetTm(NId2)-GetTm(NId1), 2)); // rayleigh
13 
14  return (-1);
15 }
TFlt Eps
Definition: cascnetinf.h:23
double Val
Definition: dt.h:1385
TInt Model
Definition: cascdynetinf.h:88
double GetTm(const int &NId) const
Definition: cascdynetinf.h:104
TFlt Alpha
Definition: cascnetinf.h:23
bool IsNode(const int &NId) const
Definition: cascdynetinf.h:109

Here is the call graph for this function:

Here is the caller graph for this function:

double TCascade::UpdateProb ( const int &  N1,
const int &  N2,
const bool &  UpdateProb = false 
)

Definition at line 47 of file cascnetinf.cpp.

References CurProb, THash< TKey, TDat, THashFunc >::GetDat(), GetParent(), GetTm(), IsNode(), NIdHitH, THitInfo::Parent, and TransProb().

47  {
48  if (!IsNode(N1) || !IsNode(N2)) { return CurProb; }
49  if (GetTm(N1) >= GetTm(N2)) { return CurProb; }
50  const double P1 = log(TransProb(GetParent(N2), N2));
51  const double P2 = log(TransProb(N1, N2)); // N1 influences N2
52  if (P1 < P2) {
53  if (UpdateProb) { // the edge is there, update the CurProb and best Parent
54  CurProb = CurProb - P1 + P2;
55  NIdHitH.GetDat(N2).Parent = N1;
56  } else {
57  return CurProb - P1 + P2; }
58  }
59  return CurProb;
60 }
TFlt CurProb
Definition: cascnetinf.h:23
int GetParent(const int NId) const
Definition: cascnetinf.h:36
double TransProb(const int &NId1, const int &NId2) const
Definition: cascnetinf.cpp:4
THash< TInt, THitInfo > NIdHitH
Definition: cascdynetinf.h:87
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
double UpdateProb(const int &N1, const int &N2, const bool &UpdateProb=false)
Definition: cascnetinf.cpp:47
double GetTm(const int &NId) const
Definition: cascdynetinf.h:104
TInt Parent
Definition: cascnetinf.h:9
bool IsNode(const int &NId) const
Definition: cascdynetinf.h:109

Here is the call graph for this function:

Member Data Documentation

TFlt TCascade::Alpha

Definition at line 23 of file cascnetinf.h.

Referenced by Clr(), GetAlpha(), Save(), and TransProb().

TInt TCascade::CId

Definition at line 86 of file cascdynetinf.h.

Referenced by TNIBs::AddCasc(), GetId(), Save(), and TCascade().

TFlt TCascade::CurProb

Definition at line 23 of file cascnetinf.h.

Referenced by Clr(), InitProb(), Save(), and UpdateProb().

TFlt TCascade::Eps

Definition at line 23 of file cascnetinf.h.

Referenced by GetProb(), InitProb(), and TransProb().

TInt TCascade::Model

Definition at line 88 of file cascdynetinf.h.

Referenced by GetModel(), Save(), TCascade(), and TransProb().


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