10 for (
int64 i = 0; i < N; i++) {
16 for (
int64 i = 0; i < N; i++) {
24 while (UnderV.
Len() > 0 && OverV.
Len() > 0) {
30 UTbl[Large] = UTbl[Large] + UTbl[Small] - 1;
31 if (UTbl[Large] < 1) {
49 if (Verbose && NCnt%100 == 0) {
50 printf(
"\rPreprocessing progress: %.2lf%% ",(
double)NCnt*100/(
double)(InNet->GetNodes()));fflush(stdout);
64 if (!(InNet->GetEDat(CurrI.
GetId(), FId, Weight))){
continue; }
65 if (FId==NI.
GetId()) {
66 PTable.
Add(Weight / ParamP);
67 Psum += Weight / ParamP;
68 }
else if (NbrH.
IsKey(FId)) {
72 PTable.
Add(Weight / ParamQ);
73 Psum += Weight / ParamQ;
87 for (
TWNet::TNodeI NI = InNet->BegNI(); NI < InNet->EndNI(); NI++) {
90 for (
TWNet::TNodeI NI = InNet->BegNI(); NI < InNet->EndNI(); NI++) {
91 for (
int64 i = 0; i < NI.GetOutDeg(); i++) {
98 for (
TWNet::TNodeI NI = InNet->BegNI(); NI < InNet->EndNI(); NI++) {
101 #pragma omp parallel for schedule(dynamic)
102 for (
int64 i = 0; i < NIds.
Len(); i++) {
103 PreprocessNode(InNet, ParamP, ParamQ, InNet->GetNI(NIds[i]), NCnt, Verbose);
105 if(Verbose){ printf(
"\n"); }
110 for (
TWNet::TNodeI NI = InNet->BegNI(); NI < InNet->EndNI(); NI++) {
111 for (
int64 i = 0; i < NI.GetOutDeg(); i++) {
122 if (WalkLen == 1) {
return; }
123 if (InNet->GetNI(StartNId).GetOutDeg() == 0) {
return; }
124 WalkV.
Add(InNet->GetNI(StartNId).GetNbrNId(Rnd.
GetUniDevInt(InNet->GetNI(StartNId).GetOutDeg())));
125 while (WalkV.
Len() < WalkLen) {
128 if (InNet->GetNI(Dst).GetOutDeg() == 0) {
return; }
130 WalkV.
Add(InNet->GetNI(Dst).GetNbrNId(Next));
THash< TInt, TIntVFltVPr > TIntIntVFltVPrH
int64 AliasDrawInt(TIntVFltVPr &NTTable, TRnd &Rnd)
const TVal1 & GetVal1() const
TSizeTy Len() const
Returns the number of elements in the vector.
const TVal2 & GetVal2() const
int64 PredictMemoryRequirements(PWNet &InNet)
int GetNbrNId(const int &NodeN) const
Returns ID of NodeN-th neighboring node.
void GetNodeAlias(TFltV &PTblV, TIntVFltVPr &NTTable)
void SimulateWalk(PWNet &InNet, int64 StartNId, int &WalkLen, TRnd &Rnd, TIntV &WalkV)
Simulates one walk and writes it into Walk vector.
int GetOutDeg() const
Returns out-degree of the current node.
const TVal & LastLast() const
Returns a reference to the one before last element of the vector.
const TVal & Last() const
Returns a reference to the last element of the vector.
Node iterator. Only forward iteration (operator++) is supported.
void PreprocessTransitionProbs(PWNet &InNet, double &ParamP, double &ParamQ, bool &Verbose)
Preprocesses transition probabilities for random walks. Has to be called once before SimulateWalk cal...
int AddKey(const TKey &Key)
int GetUniDevInt(const int &Range=0)
bool IsKey(const TKey &Key) const
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
void DelLast()
Removes the last element of the vector.
void PreprocessNode(PWNet &InNet, double &ParamP, double &ParamQ, TWNet::TNodeI NI, int64 &NCnt, bool &Verbose)
int GetId() const
Returns ID of the current node.
const TNodeData & GetDat() const