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
|
#include <cascdynetinf.h>
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, THitInfo > | NIdHitH |
TInt | Model |
TFlt | CurProb |
TFlt | Alpha |
TFlt | Eps |
Definition at line 84 of file cascdynetinf.h.
TCascade::TCascade | ( | ) | [inline] |
Definition at line 90 of file cascdynetinf.h.
TCascade::TCascade | ( | const int & | model | ) | [inline] |
Definition at line 91 of file cascdynetinf.h.
TCascade::TCascade | ( | const int & | cid, |
const int & | model | ||
) | [inline] |
Definition at line 92 of file cascdynetinf.h.
TCascade::TCascade | ( | TSIn & | SIn | ) | [inline] |
Definition at line 93 of file cascdynetinf.h.
TCascade::TCascade | ( | ) | [inline] |
TCascade::TCascade | ( | const double & | alpha | ) | [inline] |
TCascade::TCascade | ( | const double & | alpha, |
const int & | model | ||
) | [inline] |
TCascade::TCascade | ( | const double & | alpha, |
const double & | eps | ||
) | [inline] |
TCascade::TCascade | ( | const double & | alpha, |
const int & | model, | ||
const double & | eps | ||
) | [inline] |
TCascade::TCascade | ( | TSIn & | SIn | ) | [inline] |
Definition at line 31 of file cascnetinf.h.
void TCascade::Add | ( | const int & | NId, |
const double & | HitTm | ||
) | [inline] |
Definition at line 39 of file cascnetinf.h.
void TCascade::Add | ( | const int & | NId, |
const double & | HitTm | ||
) | [inline] |
Definition at line 107 of file cascdynetinf.h.
THash<TInt, THitInfo>::TIter TCascade::BegI | ( | ) | const [inline] |
Definition at line 101 of file cascdynetinf.h.
void TCascade::Clr | ( | ) | [inline] |
void TCascade::Clr | ( | ) | [inline] |
Definition at line 95 of file cascdynetinf.h.
void TCascade::Del | ( | const int & | NId | ) | [inline] |
Definition at line 40 of file cascnetinf.h.
void TCascade::Del | ( | const int & | NId | ) | [inline] |
Definition at line 108 of file cascdynetinf.h.
THash<TInt, THitInfo>::TIter TCascade::EndI | ( | ) | const [inline] |
Definition at line 102 of file cascdynetinf.h.
double TCascade::GetAlpha | ( | ) | const [inline] |
Definition at line 37 of file cascnetinf.h.
{ return Alpha; }
int TCascade::GetId | ( | ) | [inline] |
Definition at line 96 of file cascdynetinf.h.
{ return CId; }
double TCascade::GetMaxTm | ( | ) | const [inline] |
Definition at line 105 of file cascdynetinf.h.
double TCascade::GetMinTm | ( | ) | const [inline] |
Definition at line 106 of file cascdynetinf.h.
{ return NIdHitH[0].Tm; } // we assume the cascade is sorted
int TCascade::GetModel | ( | ) | const [inline] |
Definition at line 103 of file cascdynetinf.h.
{ return Model; }
int TCascade::GetNode | ( | const int & | i | ) | const [inline] |
Definition at line 35 of file cascnetinf.h.
int TCascade::GetNode | ( | const int & | i | ) | const [inline] |
Definition at line 100 of file cascdynetinf.h.
int TCascade::GetParent | ( | const int | NId | ) | const [inline] |
Definition at line 36 of file cascnetinf.h.
double TCascade::GetProb | ( | const PNGraph & | G | ) |
Definition at line 17 of file cascnetinf.cpp.
{ double P = 0; for (int n = 0; n < Len(); n++) { const int DstNId = GetNode(n); const double DstTm = GetTm(DstNId); TNGraph::TNodeI NI = G->GetNI(DstNId); double MxProb = log(Eps); int BestParent = -1; for (int e = 0; e < NI.GetInDeg(); e++) { const int SrcNId = NI.GetInNId(e); if (IsNode(SrcNId) && GetTm(SrcNId) < DstTm) { const double Prob = log(TransProb(SrcNId, DstNId)); if (MxProb < Prob) { MxProb = Prob; BestParent = SrcNId; } } } NIdHitH.GetDat(DstNId).Parent = BestParent; P += MxProb; } return P; }
double TCascade::GetTm | ( | const int & | NId | ) | const [inline] |
Definition at line 38 of file cascnetinf.h.
double TCascade::GetTm | ( | const int & | NId | ) | const [inline] |
Definition at line 104 of file cascdynetinf.h.
void TCascade::InitProb | ( | ) |
bool TCascade::IsNode | ( | const int & | NId | ) | const [inline] |
Definition at line 41 of file cascnetinf.h.
bool TCascade::IsNode | ( | const int & | NId | ) | const [inline] |
Definition at line 109 of file cascdynetinf.h.
int TCascade::Len | ( | ) | const [inline] |
Definition at line 34 of file cascnetinf.h.
int TCascade::Len | ( | ) | const [inline] |
Definition at line 97 of file cascdynetinf.h.
int TCascade::LenAfterT | ( | const double & | T | ) | [inline] |
int TCascade::LenBeforeT | ( | const double & | T | ) | [inline] |
Definition at line 98 of file cascdynetinf.h.
bool TCascade::operator< | ( | const TCascade & | Cascade | ) | const [inline] |
Definition at line 111 of file cascdynetinf.h.
void TCascade::Save | ( | TSOut & | SOut | ) | const [inline] |
void TCascade::Save | ( | TSOut & | SOut | ) | const [inline] |
void TCascade::Sort | ( | ) | [inline] |
Definition at line 42 of file cascnetinf.h.
void TCascade::Sort | ( | ) | [inline] |
Definition at line 110 of file cascdynetinf.h.
double TCascade::TransProb | ( | const int & | NId1, |
const int & | NId2 | ||
) | const |
Definition at line 4 of file cascnetinf.cpp.
{ if (!IsNode(NId1) || !IsNode(NId2)) { return Eps.Val; } if (GetTm(NId1) >= GetTm(NId2)) { return Eps.Val; } if (Model==0) return Alpha*exp(-Alpha*(GetTm(NId2)-GetTm(NId1))); // exponential else if (Model==1) return (Alpha-1)*pow((GetTm(NId2)-GetTm(NId1)), -Alpha); // power-law else return Alpha*(GetTm(NId2)-GetTm(NId1))*exp(-0.5*Alpha*pow(GetTm(NId2)-GetTm(NId1), 2)); // rayleigh return (-1); }
double TCascade::UpdateProb | ( | const int & | N1, |
const int & | N2, | ||
const bool & | UpdateProb = false |
||
) |
Definition at line 47 of file cascnetinf.cpp.
{ if (!IsNode(N1) || !IsNode(N2)) { return CurProb; } if (GetTm(N1) >= GetTm(N2)) { return CurProb; } const double P1 = log(TransProb(GetParent(N2), N2)); const double P2 = log(TransProb(N1, N2)); // N1 influences N2 if (P1 < P2) { if (UpdateProb) { // the edge is there, update the CurProb and best Parent CurProb = CurProb - P1 + P2; NIdHitH.GetDat(N2).Parent = N1; } else { return CurProb - P1 + P2; } } return CurProb; }
Definition at line 23 of file cascnetinf.h.
Definition at line 86 of file cascdynetinf.h.
Definition at line 23 of file cascnetinf.h.
Definition at line 23 of file cascnetinf.h.
Definition at line 88 of file cascdynetinf.h.
Definition at line 87 of file cascdynetinf.h.