|
SNAP Library 2.1, Developer 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 | |
| TMAGNodeSimple () | |
| TMAGNodeSimple (const int &_Dim, const double &_Mu=0.5) | |
| TMAGNodeSimple (const TMAGNodeSimple &Simple) | |
| TMAGNodeSimple & | operator= (const TMAGNodeSimple &Simple) |
| 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 | |
| TFlt | Mu |
| TInt | Dim |
| TMAGNodeSimple::TMAGNodeSimple | ( | ) | [inline] |
| TMAGNodeSimple::TMAGNodeSimple | ( | const int & | _Dim, |
| const double & | _Mu = 0.5 |
||
| ) | [inline] |
| TMAGNodeSimple::TMAGNodeSimple | ( | const TMAGNodeSimple & | Simple | ) | [inline] |
| void TMAGNodeSimple::AttrGen | ( | TIntVV & | AttrVV, |
| const int & | NNodes | ||
| ) |
Definition at line 201 of file mag.cpp.
References TVVec< TVal >::At(), Dim, TVVec< TVal >::Gen(), IAssert, Mu, and TVVec< TVal >::PutAll().
{
IAssert(Dim > 0);
AttrVV.Gen(NNodes, Dim);
AttrVV.PutAll(0);
for(int i = 0; i < NNodes; i++) {
for(int l = 0; l < Dim; l++) {
if((TMAGNodeSimple::Rnd).GetUniDev() > Mu) {
AttrVV.At(i, l) = 1;
}
}
}
}

| void TMAGNodeSimple::LoadTxt | ( | const TStr & | InFNm | ) |
Definition at line 215 of file mag.cpp.
References TStr::CStr(), TStr::GetFlt(), IAssertR, and Mu.
{
FILE *fp = fopen(InFNm.CStr(), "r");
IAssertR(fp != NULL, "File does not exist: " + InFNm);
char buf[128];
char *token;
TStr TokenStr;
TFlt Val;
token = strtok(buf, "&");
token = strtok(token, " \t");
TokenStr = TStr(token);
Mu = TokenStr.GetFlt(Val);
fclose(fp);
}

| TMAGNodeSimple& TMAGNodeSimple::operator= | ( | const TMAGNodeSimple & | Simple | ) | [inline] |
| void TMAGNodeSimple::SaveTxt | ( | TStrV & | OutStrV | ) | const |
Definition at line 232 of file mag.cpp.
References TVec< TVal, TSizeTy >::Add(), Dim, TStr::Fmt(), TVec< TVal, TSizeTy >::Gen(), and Mu.

TInt TMAGNodeSimple::Dim [private] |
Definition at line 72 of file mag.h.
Referenced by AttrGen(), operator=(), and SaveTxt().
TFlt TMAGNodeSimple::Mu [private] |
Definition at line 71 of file mag.h.
Referenced by AttrGen(), LoadTxt(), operator=(), SaveTxt(), and TMAGNodeSimple().
TRnd TMAGNodeSimple::Rnd = TRnd(0) [static] |