|
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 <mag.h>
Public Member Functions | |
| TMAGNodeBern () | |
| TMAGNodeBern (const int &_Dim, const double &_Mu=0.5) | |
| TMAGNodeBern (const TFltV &_MuV) | |
| TMAGNodeBern (const TMAGNodeBern &Dist) | |
| TMAGNodeBern & | operator= (const TMAGNodeBern &Dist) |
| void | SetMuV (const TFltV &_MuV) |
| const TFltV & | GetMuV () const |
| void | SetMu (const int &Attr, const double &Prob) |
| double | GetMu (const int &Attr) const |
| void | LoadTxt (const TStr &InFNm) |
| void | SaveTxt (TStrV &OutStrV) const |
| void | AttrGen (TIntVV &AttrVV, const int &NNodes) |
Static Public Attributes | |
| static TRnd | Rnd = TRnd(0) |
Private Attributes | |
| TFltV | MuV |
| TInt | Dim |
| TMAGNodeBern::TMAGNodeBern | ( | ) | [inline] |
| TMAGNodeBern::TMAGNodeBern | ( | const int & | _Dim, |
| const double & | _Mu = 0.5 |
||
| ) | [inline] |
| TMAGNodeBern::TMAGNodeBern | ( | const TFltV & | _MuV | ) | [inline] |
| TMAGNodeBern::TMAGNodeBern | ( | const TMAGNodeBern & | Dist | ) | [inline] |
| void TMAGNodeBern::AttrGen | ( | TIntVV & | AttrVV, |
| const int & | NNodes | ||
| ) |
| double TMAGNodeBern::GetMu | ( | const int & | Attr | ) | const [inline] |
| const TFltV& TMAGNodeBern::GetMuV | ( | ) | const [inline] |
| void TMAGNodeBern::LoadTxt | ( | const TStr & | InFNm | ) |
Definition at line 264 of file mag.cpp.
{
FILE *fp = fopen(InFNm.CStr(), "r");
IAssertR(fp != NULL, "File does not exist: " + InFNm);
Dim = 0;
MuV.Gen(10, 0);
char buf[128];
char *token;
TStr TokenStr;
TFlt Val;
while(fgets(buf, sizeof(buf), fp) != NULL) {
token = strtok(buf, "&");
token = strtok(token, " \t");
TokenStr = TStr(token);
MuV.Add(TokenStr.GetFlt(Val));
}
Dim = MuV.Len();
fclose(fp);
}
| TMAGNodeBern & TMAGNodeBern::operator= | ( | const TMAGNodeBern & | Dist | ) |
| void TMAGNodeBern::SaveTxt | ( | TStrV & | OutStrV | ) | const |
| void TMAGNodeBern::SetMu | ( | const int & | Attr, |
| const double & | Prob | ||
| ) | [inline] |
| void TMAGNodeBern::SetMuV | ( | const TFltV & | _MuV | ) | [inline] |
TInt TMAGNodeBern::Dim [private] |
TFltV TMAGNodeBern::MuV [private] |
TRnd TMAGNodeBern::Rnd = TRnd(0) [static] |