SNAP Library 6.0, User Reference  2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
agm.h
Go to the documentation of this file.
1 #ifndef snap_agm_h
2 #define snap_agm_h
3 #include "Snap.h"
4 
7 class TAGM {
8 public:
9  static void RndConnectInsideCommunity(PUNGraph& Graph, const TIntV& CmtyV, const double& Prob, TRnd& Rnd);
10  // OP RS 2014/04/10, commented out since there is no implementation
11  //static PUNGraph GenAGM(const TIntV& NIdV , THash<TInt,TIntV >& CmtyVH, const TStr& AGMNm, const double& PiCoef, const double& ProbBase, TRnd& Rnd=TInt::Rnd);
12  static PUNGraph GenAGM(TVec<TIntV >& CmtyVV, const double& DensityCoef, const double& ScaleCoef, TRnd& Rnd=TInt::Rnd);
13  static PUNGraph GenAGM(TVec<TIntV>& CmtyVV, const double& DensityCoef, const int TargetEdges, TRnd& Rnd);
14  static PUNGraph GenAGM(TVec<TIntV>& CmtyVV, const TFltV& CProbV, TRnd& Rnd, const double PNoCom = -1.0);
15 };
16 
19 class TAGMUtil {
20 public:
21  static void GenPLSeq(TIntV& SzSeq,const int& SeqLen, const double& Alpha, TRnd& Rnd, const int& Min, const int& Max);
22  static void ConnectCmtyVV(TVec<TIntV>& CmtyVV, const TIntPrV& CIDSzPrV, const TIntPrV& NIDMemPrV, TRnd& Rnd);
23  static void GenCmtyVVFromPL(TVec<TIntV>& CmtyVV, const PUNGraph& Graph, const int& Nodes, const int& Coms, const double& ComSzAlpha, const double& MemAlpha, const int& MinSz, const int& MaxSz, const int& MinK, const int& MaxK, TRnd& Rnd);
24  static void GenCmtyVVFromPL(TVec<TIntV>& CmtyVV, const TIntV& NIDV, const int& Nodes, const int& Coms, const double& ComSzAlpha, const double& MemAlpha, const int& MinSz, const int& MaxSz, const int& MinK, const int& MaxK, TRnd& Rnd);
25  static void GenCmtyVVFromPL(TVec<TIntV>& CmtyVV, const int& Nodes, const int& Coms, const double& ComSzAlpha, const double& MemAlpha, const int& MinSz, const int& MaxSz, const int& MinK, const int& MaxK, TRnd& Rnd);
26  // OP RS 2014/04/10, commented out since there is no implementation
27  //static void RndConnectInsideCommunity(PUNGraph& Graph, const TIntV& CmtyV, const double& Prob, TRnd& Rnd);
28  // OP RS 2014/04/10, commented out since there is no implementation
29  //static PUNGraph GenAGM(TVec<TIntV >& CmtyVV, const double& DensityCoef, const double& ScaleCoef, TRnd& Rnd=TInt::Rnd);
30  // OP RS 2014/04/10, commented out since there is no implementation
31  //static PUNGraph GenAGM(TVec<TIntV>& CmtyVV, const double& DensityCoef, const int TargetEdges, TRnd& Rnd);
32  // OP RS 2014/04/10, commented out since there is no implementation
33  //static PUNGraph GenAGM(TVec<TIntV>& CmtyVV, const TFltV& CProbV, TRnd& Rnd, const double PNoCom = -1.0);
34  static void GetNodeMembership(THash<TInt,TIntSet >& NIDComVH, const TVec<TIntV>& CmtyVV);
35  static void GetNodeMembership(THash<TInt,TIntSet >& NIDComVH, const TVec<TIntV>& CmtyVV, const TIntV& NIDV);
36  static void GetNodeMembership(TIntH& NIDComVH, const THash<TInt,TIntV >& CmtyVH);
37  static void GetNodeMembership(THash<TInt,TIntSet >& NIDComVH, const TVec<TIntSet>& CmtyVV);
38  static void GetNodeMembership(THash<TInt,TIntSet >& NIDComVH, const THash<TInt,TIntV >& CmtyVH);
39  static void GetNodeMembership(THash<TInt,TIntV >& NIDComVH, const THash<TInt,TIntV >& CmtyVH);
40  static void GetNodeMembership(THash<TInt,TIntV >& NIDComVH, const TVec<TIntV >& CmtyVV);
41  // OP RS 2014/04/10, commented out since there is no implementation
42  //static void GetNodeMembership(TIntH& NIDComVH, const TVec<TIntV >& CmtyVV);
43  static void LoadCmtyVV(const TStr& InFNm, TVec<TIntV>& CmtyVV);
44  static void LoadCmtyVV(const TStr& InFNm, TVec<TIntV>& CmtyVV, TStrHash<TInt>& StrToNIdH, const int BeginCol, const int MinSz = 3, const TSsFmt Sep = ssfTabSep);
45  static void DumpCmtyVV(const TStr& OutFNm, const TVec<TIntV>& CmtyVV);
46  static void DumpCmtyVV(const TStr OutFNm, TVec<TIntV>& CmtyVV, TIntStrH& NIDNmH);
47  static int TotalMemberships(const TVec<TIntV>& CmtyVV);
48  static void RewireCmtyVV(const TVec<TIntV>& CmtyVVIn, TVec<TIntV>& CmtyVVOut, TRnd& Rnd);
49  static void RewireCmtyNID(THash<TInt,TIntV >& CmtyVH, TRnd& Rnd);
50  static int Intersection(const TIntV& C1, const TIntV& C2);
51  static void GetIntersection(const THashSet<TInt>& A, const THashSet<TInt>& B, THashSet<TInt>& C);
52  static int Intersection(const THashSet<TInt>& A, const THashSet<TInt>& B);
53  static double GetConductance(const PUNGraph& Graph, const TIntSet& CmtyS, const int Edges);
54  static void GetNbhCom(const PUNGraph& Graph, const int NID, TIntSet& NBCmtyS);
55  static void SaveGephi(const TStr& OutFNm, const PUNGraph& G, const TVec<TIntV >& CmtyVVAtr, const double MaxSz, const double MinSz) {
56  THash<TInt, TStr> TmpH;
57  SaveGephi(OutFNm, G, CmtyVVAtr, MaxSz, MinSz, TmpH);
58  }
59  static void SaveGephi(const TStr& OutFNm, const PUNGraph& G, const TVec<TIntV >& CmtyVVAtr, const double MaxSz, const double MinSz, const THash<TInt, TStr>& NIDNameH) {
60  THash<TInt, TIntTr> TmpH;
61  SaveGephi(OutFNm, G, CmtyVVAtr, MaxSz, MinSz, NIDNameH, TmpH);
62  }
63  static void SaveGephi(const TStr& OutFNm, const PUNGraph& G, const TVec<TIntV >& CmtyVVAtr, const double MaxSz, const double MinSz, const THash<TInt, TStr>& NIDNameH, const THash<TInt, TIntTr >& NIDColorH);
64  static void SaveBipartiteGephi(const TStr& OutFNm, const TIntV& NIDV, const TVec<TIntV>& CmtyVV, const double MaxSz, const double MinSz, const TIntStrH& NIDNameH, const THash<TInt, TIntTr >& NIDColorH, const THash<TInt, TIntTr >& CIDColorH);
65  static int FindComsByAGM(const PUNGraph& Graph, const int InitComs, const int MaxIter, const int RndSeed, const double RegGap, const double PNoCom = 0.0, const TStr PltFPrx = TStr());
66  template <class PGraph>
67  static PGraph LoadEdgeListStr(const TStr& InFNm, TIntStrH& NIDNameH, const int& SrcColId = 0, const int& DstColId = 1, const TSsFmt SsFmt = ssfTabSep) {
68  TSsParser Ss(InFNm, SsFmt);
69  PGraph Graph = PGraph::TObj::New();
70  TStrHash<TInt> StrSet(Mega(1), true);
71  while (Ss.Next()) {
72  const int SrcNId = StrSet.AddKey(Ss[SrcColId]);
73  const int DstNId = StrSet.AddKey(Ss[DstColId]);
74  if (! Graph->IsNode(SrcNId)) { Graph->AddNode(SrcNId); }
75  if (! Graph->IsNode(DstNId)) { Graph->AddNode(DstNId); }
76  Graph->AddEdge(SrcNId, DstNId);
77  }
78  NIDNameH.Gen(StrSet.Len());
79  for (int s = 0; s < StrSet.Len(); s++) { NIDNameH.AddDat(s, StrSet.GetKey(s)); }
80  IAssert(NIDNameH.Len() == Graph->GetNodes());
81 
82  Graph->Defrag();
83  return Graph;
84  }
85  template <class PGraph>
86  static PGraph LoadEdgeListStr(const TStr& InFNm, TStrHash<TInt>& NodeNameH, const int& SrcColId = 0, const int& DstColId = 1, const TSsFmt SsFmt = ssfTabSep) {
87  TSsParser Ss(InFNm, SsFmt);
88  PGraph Graph = PGraph::TObj::New();
89  TStrHash<TInt> StrSet(Mega(1), true);
90  while (Ss.Next()) {
91  const int SrcNId = StrSet.AddKey(Ss[SrcColId]);
92  const int DstNId = StrSet.AddKey(Ss[DstColId]);
93  if (! Graph->IsNode(SrcNId)) { Graph->AddNode(SrcNId); }
94  if (! Graph->IsNode(DstNId)) { Graph->AddNode(DstNId); }
95  Graph->AddEdge(SrcNId, DstNId);
96  }
97  NodeNameH = StrSet;
98  NodeNameH.Pack();
99 
100  Graph->Defrag();
101  return Graph;
102  }
103 
104  template<class PGraph>
105  static void GVizComGraph(const PGraph& Graph,const TVec<TIntV >& CmtyVV, const TStr& OutFNm, const TStr& Desc = TStr()){
106  TStrV Colors = TStrV::GetV("red","blue","green","pink","cyan");
107  TStrV Shapes = TStrV::GetV("ellipse","triangle","square","pentagon","hexagon");
108  THash<TInt,TIntV> NIDComVH;
109  GetNodeMembership(NIDComVH,CmtyVV);
110 
111  const TStr Ext = OutFNm.GetFExt();
112  const TStr GraphFNm = OutFNm.GetSubStr(0, OutFNm.Len() - Ext.Len()) + "dot";
113  const bool IsDir = HasGraphFlag(typename PGraph::TObj, gfDirected);
114  FILE *F = fopen(GraphFNm.CStr(), "wt");
115  if (! Desc.Empty()) fprintf(F, "/*****\n%s\n*****/\n\n", Desc.CStr());
116  if (IsDir) { fprintf(F, "digraph G {\n"); } else { fprintf(F, "graph G {\n"); }
117  fprintf(F, " graph [splines=false overlap=false]\n"); //size=\"12,10\" ratio=fill
118  fprintf(F, " node [width=0.3, height=0.3]\n");
119  //nodes
120  for (typename PGraph::TObj::TNodeI NI = Graph->BegNI(); NI < Graph->EndNI(); NI++) {
121  int NID = NI.GetId();
122  TIntV& CIDV = NIDComVH.GetDat(NID);
123  IAssert(CIDV.Len()>0);
124  TStr ShapeNm = Shapes[(CIDV.Len()-1) % Shapes.Len()];
125  TStr ColorNm = Colors[CIDV[0] % Colors.Len()];
126  TStr NodeComLabel = TStr::Fmt("%d(",NID);
127  for(int i=0;i<CIDV.Len();i++) {
128  TStr TmpStr = TStr::Fmt("%d",int(CIDV[i]));
129  NodeComLabel += TmpStr;
130  if(i<CIDV.Len()-1){NodeComLabel+=",";}
131  }
132  NodeComLabel += ")";
133  fprintf(F, " %d [style=filled, shape=\"%s\" fillcolor=\"%s\" label=\"%s\"];\n", NI.GetId(), ShapeNm.CStr(),ColorNm.CStr(), NodeComLabel.CStr());
134  }
135 
136  // edges
137  for (typename PGraph::TObj::TNodeI NI = Graph->BegNI(); NI < Graph->EndNI(); NI++) {
138  if (NI.GetOutDeg()==0 && NI.GetInDeg()==0 ) {
139  fprintf(F, "%d;\n", NI.GetId()); }
140  else {
141  for (int e = 0; e < NI.GetOutDeg(); e++) {
142  if (! IsDir && NI.GetId() > NI.GetOutNId(e)) { continue; }
143  fprintf(F, " %d %s %d;\n", NI.GetId(), IsDir?"->":"--", NI.GetOutNId(e));
144  }
145  }
146  }
147  if (! Desc.Empty()) {
148  fprintf(F, " label = \"\\n%s\\n\";", Desc.CStr());
149  fprintf(F, " fontsize=24;\n");
150  }
151  fprintf(F, "}\n");
152  fclose(F);
153  TSnap::TSnapDetail::GVizDoLayout(GraphFNm, OutFNm, gvlNeato);
154  }
155 };
156 
157 //Light version of logistic regression (originally in Snap)-- Jaewon Yang, 04/07/12
158 // forward
161 
163 // Logistic Regression using gradient descent
164 // X: N * M matrix where N = number of examples and M = number of features.
165 //J: JAEWON THIS HAS NOTHING TO DO WITH AGM. THIS NEEDS TO BE MOVED SOMEWHERE ELSE (glib/xmath.h)
166 //J: BUT I THINK THERE IS ALREADY A LOGISTIC REGRESSION CLASS THERE!!
167 class TLogRegFit {
168 private:
172  int M; // number of features
173 public:
176  // returns model for logistic regression
177  PLogRegPredict CalcLogRegGradient(const TVec<TFltV>& XPt, const TFltV& yPt, const TStr& PlotNm = TStr(), const double& ChangeEps = 0.01, const int& MaxStep = 200, const bool InterceptPt = false);
178  PLogRegPredict CalcLogRegNewton(const TVec<TFltV>& XPt, const TFltV& yPt, const TStr& PlotNm = TStr(), const double& ChangeEps = 0.01, const int& MaxStep = 200, const bool InterceptPt = false);
179  int MLEGradient(const double& ChangeEps, const int& MaxStep, const TStr PlotNm);
180  int MLENewton(const double& ChangeEps, const int& MaxStep, const TStr PlotNm);
181  double GetStepSizeByLineSearch(const TFltV& DeltaV, const TFltV& GradV, const double& Alpha, const double& Beta);
182  double Likelihood(const TFltV& NewTheta);
183  double Likelihood() { return Likelihood(Theta); }
184  void Gradient(TFltV& GradV);
185  void Hessian(TFltVV& HVV);
186  void GetNewtonStep(TFltVV& HVV, const TFltV& GradV, TFltV& DeltaLV);
187 };
188 
189 
191 // Logistic-Regression-Model
192 //J: JAEWON THIS HAS NOTHING TO DO WITH AGM. THIS NEEDS TO BE MOVED SOMEWHERE ELSE (glib/xmath.h)
193 //J: BUT I THINK THERE IS ALREADY A LOGISTIC REGRESSION CLASS THERE!!
195 private:
197 private:
199 public:
200  TLogRegPredict(const TFltV& _bb): Theta(_bb) { };
201  //static PLogRegMd New(PSparseTrainSet Set) { return TLogReg::CalcLogReg(Set); }; //TODO
202 
203  TLogRegPredict(TSIn& SIn) { Theta.Load(SIn); };
204  static PLogRegPredict Load(TSIn& SIn) { return new TLogRegPredict(SIn); };
205  void Save(TSOut& SOut) const { Theta.Save(SOut); };
206 
208 public:
209  // classifies vector, returns probability that AttrV is positive
210  static void GetCfy(const TVec<TFltV>& X, TFltV& OutV, const TFltV& NewTheta);
211  static double GetCfy(const TFltV& AttrV, const TFltV& NewTheta);
212  double GetCfy(const TFltV& AttrV) { return GetCfy(AttrV, Theta); }
213  void GetTheta(TFltV& _Theta) { _Theta = Theta; }
214  void GetCfy(const TVec<TFltV>& X, TFltV& OutV) { GetCfy(X, OutV, Theta); }
215  void PrintTheta() { for (int t = 0; t < Theta.Len(); t++) { printf("Theta[%d] = %f\n", t, Theta[t].Val); } }
216  friend class TPt<TLogRegPredict>;
217 };
218 
219 #endif
TVec< TFltV > X
Definition: agm.h:169
Definition: bd.h:440
#define IAssert(Cond)
Definition: bd.h:262
void GetCfy(const TVec< TFltV > &X, TFltV &OutV)
Definition: agm.h:214
static void GetNbhCom(const PUNGraph &Graph, const int NID, TIntSet &NBCmtyS)
Definition: agm.cpp:706
void GetNewtonStep(TFltVV &HVV, const TFltV &GradV, TFltV &DeltaLV)
Definition: agm.cpp:718
int Len() const
Definition: dt.h:490
static int TotalMemberships(const TVec< TIntV > &CmtyVV)
total number of memberships (== sum of the sizes of communities)
Definition: agm.cpp:315
static void RewireCmtyVV(const TVec< TIntV > &CmtyVVIn, TVec< TIntV > &CmtyVVOut, TRnd &Rnd)
rewire bipartite community affiliation graphs
Definition: agm.cpp:192
Definition: dt.h:11
static void GetNodeMembership(THash< TInt, TIntSet > &NIDComVH, const TVec< TIntV > &CmtyVV)
get hash table of
Definition: agm.cpp:335
static void GetCfy(const TVec< TFltV > &X, TFltV &OutV, const TFltV &NewTheta)
Definition: agm.cpp:933
static void GenPLSeq(TIntV &SzSeq, const int &SeqLen, const double &Alpha, TRnd &Rnd, const int &Min, const int &Max)
AGMUtil:: Utilities for AGM.
Definition: agm.cpp:81
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
UndefDefaultCopyAssign(TLogRegPredict)
int Len() const
Definition: hash.h:842
static int Intersection(const TIntV &C1, const TIntV &C2)
Definition: agm.cpp:399
Definition: ss.h:72
double Likelihood()
Definition: agm.h:183
void GetTheta(TFltV &_Theta)
Definition: agm.h:213
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
TStr GetFExt() const
Definition: dt.cpp:1421
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
static void GetIntersection(const THashSet< TInt > &A, const THashSet< TInt > &B, THashSet< TInt > &C)
Definition: agm.cpp:404
void Load(TSIn &SIn)
Definition: ds.h:946
static double GetConductance(const PUNGraph &Graph, const TIntSet &CmtyS, const int Edges)
Definition: agm.cpp:683
static TRnd Rnd
Definition: dt.h:1146
void Pack()
Definition: hash.h:915
Definition: gviz.h:3
static PGraph LoadEdgeListStr(const TStr &InFNm, TIntStrH &NIDNameH, const int &SrcColId=0, const int &DstColId=1, const TSsFmt SsFmt=ssfTabSep)
Definition: agm.h:67
Affiliation Graph Model (AGM) graph generator.
Definition: agm.h:7
TFltV Y
Definition: agm.h:170
Definition: fl.h:58
void Save(TSOut &SOut) const
Definition: ds.h:954
TSsFmt
Spread-Sheet Separator Format.
Definition: ss.h:5
TPt< TLogRegPredict > PLogRegPredict
Definition: agm.h:159
static void SaveGephi(const TStr &OutFNm, const PUNGraph &G, const TVec< TIntV > &CmtyVVAtr, const double MaxSz, const double MinSz)
Definition: agm.h:55
static void ConnectCmtyVV(TVec< TIntV > &CmtyVV, const TIntPrV &CIDSzPrV, const TIntPrV &NIDMemPrV, TRnd &Rnd)
Generate bipartite community affiliation from given power law coefficients for membership distributio...
Definition: agm.cpp:131
double GetCfy(const TFltV &AttrV)
Definition: agm.h:212
void GVizDoLayout(const TStr &GraphInFNm, TStr OutFNm, const TGVizLayout &Layout)
Runs GraphViz layout engine over a graph saved in the file GraphInFNm with output saved to OutFNm...
Definition: gviz.cpp:5
TLogRegFit()
Definition: agm.h:174
void Gen(const int &ExpectVals)
Definition: hash.h:222
#define HasGraphFlag(TGraph, Flag)
For quick testing of the properties of the graph/network object (see TGraphFlag). ...
Definition: gbase.h:41
static void GVizComGraph(const PGraph &Graph, const TVec< TIntV > &CmtyVV, const TStr &OutFNm, const TStr &Desc=TStr())
Definition: agm.h:105
TFltV Theta
Definition: agm.h:171
TCRef CRef
Definition: agm.h:196
static PGraph LoadEdgeListStr(const TStr &InFNm, TStrHash< TInt > &NodeNameH, const int &SrcColId=0, const int &DstColId=1, const TSsFmt SsFmt=ssfTabSep)
Definition: agm.h:86
Affiliation Graph Model (AGM) graph generator.
Definition: agm.h:19
void Hessian(TFltVV &HVV)
Definition: agm.cpp:746
PLogRegPredict CalcLogRegNewton(const TVec< TFltV > &XPt, const TFltV &yPt, const TStr &PlotNm=TStr(), const double &ChangeEps=0.01, const int &MaxStep=200, const bool InterceptPt=false)
Definition: agm.cpp:882
const char * GetKey(const int &KeyId) const
Definition: hash.h:893
static void GenCmtyVVFromPL(TVec< TIntV > &CmtyVV, const PUNGraph &Graph, const int &Nodes, const int &Coms, const double &ComSzAlpha, const double &MemAlpha, const int &MinSz, const int &MaxSz, const int &MinK, const int &MaxK, TRnd &Rnd)
Generate bipartite community affiliation from given power law coefficients for membership distributio...
Definition: agm.cpp:101
int M
Definition: agm.h:172
#define Mega(n)
Definition: gbase.h:4
TLogRegPredict(const TFltV &_bb)
Definition: agm.h:200
Tab separated.
Definition: ss.h:6
static void SaveGephi(const TStr &OutFNm, const PUNGraph &G, const TVec< TIntV > &CmtyVVAtr, const double MaxSz, const double MinSz, const THash< TInt, TStr > &NIDNameH)
Definition: agm.h:59
static void LoadCmtyVV(const TStr &InFNm, TVec< TIntV > &CmtyVV)
load bipartite community affiliation graph from text file (each row contains the member node IDs for ...
Definition: agm.cpp:246
Definition: fl.h:128
int MLEGradient(const double &ChangeEps, const int &MaxStep, const TStr PlotNm)
Definition: agm.cpp:797
int AddKey(const char *Key)
Definition: hash.h:968
Definition: hash.h:781
directed graph (TNGraph, TNEGraph), else graph is undirected TUNGraph
Definition: gbase.h:13
static void SaveBipartiteGephi(const TStr &OutFNm, const TIntV &NIDV, const TVec< TIntV > &CmtyVV, const double MaxSz, const double MinSz, const TIntStrH &NIDNameH, const THash< TInt, TIntTr > &NIDColorH, const THash< TInt, TIntTr > &CIDColorH)
save bipartite community affiliation into gexf file
Definition: agm.cpp:486
void Save(TSOut &SOut) const
Definition: agm.h:205
~TLogRegFit()
Definition: agm.h:175
Definition: dt.h:412
static int FindComsByAGM(const PUNGraph &Graph, const int InitComs, const int MaxIter, const int RndSeed, const double RegGap, const double PNoCom=0.0, const TStr PltFPrx=TStr())
estimate number of communities using AGM
Definition: agm.cpp:544
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
void PrintTheta()
Definition: agm.h:215
Definition: hash.h:97
double GetStepSizeByLineSearch(const TFltV &DeltaV, const TFltV &GradV, const double &Alpha, const double &Beta)
Definition: agm.cpp:837
void Gradient(TFltV &GradV)
Definition: agm.cpp:869
static PLogRegPredict Load(TSIn &SIn)
Definition: agm.h:204
static void DumpCmtyVV(const TStr &OutFNm, const TVec< TIntV > &CmtyVV)
dump bipartite community affiliation into a text file
Definition: agm.cpp:286
PLogRegPredict CalcLogRegGradient(const TVec< TFltV > &XPt, const TFltV &yPt, const TStr &PlotNm=TStr(), const double &ChangeEps=0.01, const int &MaxStep=200, const bool InterceptPt=false)
Definition: agm.cpp:901
TLogRegPredict(TSIn &SIn)
Definition: agm.h:203
int MLENewton(const double &ChangeEps, const int &MaxStep, const TStr PlotNm)
Definition: agm.cpp:770
bool Next()
Loads next line from the input file.
Definition: ss.cpp:412
TFltV Theta
Definition: agm.h:198
static void RndConnectInsideCommunity(PUNGraph &Graph, const TIntV &CmtyV, const double &Prob, TRnd &Rnd)
Connect members of a given community by Erdos-Renyi.
Definition: agm.cpp:10
static TVec< TStr, int > GetV(const TStr &Val1)
Returns a vector on element Val1.
Definition: ds.h:848
char * CStr()
Definition: dt.h:479
int Len() const
Definition: hash.h:228
static PUNGraph GenAGM(TVec< TIntV > &CmtyVV, const double &DensityCoef, const double &ScaleCoef, TRnd &Rnd=TInt::Rnd)
Definition: agm.cpp:37
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
static void RewireCmtyNID(THash< TInt, TIntV > &CmtyVH, TRnd &Rnd)
rewire bipartite community affiliation graphs
Definition: agm.cpp:202