SNAP Library 2.3, Developer Reference
2014-06-16 11:58:46
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
Affiliation Graph Model (AGM) graph generator. More...
#include <agm.h>
Static Public Member Functions | |
static void | GenPLSeq (TIntV &SzSeq, const int &SeqLen, const double &Alpha, TRnd &Rnd, const int &Min, const int &Max) |
AGMUtil:: Utilities for AGM. More... | |
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 distribution and community size distribution. More... | |
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 distribution and community size distribution. More... | |
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) |
Generate bipartite community affiliation from given power law coefficients for membership distribution and community size distribution. More... | |
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) |
Generate bipartite community affiliation from given power law coefficients for membership distribution and community size distribution. More... | |
static void | GetNodeMembership (THash< TInt, TIntSet > &NIDComVH, const TVec< TIntV > &CmtyVV) |
get hash table of <Node ID, community IDs which node belongs to> More... | |
static void | GetNodeMembership (THash< TInt, TIntSet > &NIDComVH, const TVec< TIntV > &CmtyVV, const TIntV &NIDV) |
get hash table of <Node ID, community IDs which node belongs to>. Some nodes in NIDV might belong to no community More... | |
static void | GetNodeMembership (TIntH &NIDComVH, const THash< TInt, TIntV > &CmtyVH) |
get hash table of <Node ID, membership size> More... | |
static void | GetNodeMembership (THash< TInt, TIntSet > &NIDComVH, const TVec< TIntSet > &CmtyVV) |
static void | GetNodeMembership (THash< TInt, TIntSet > &NIDComVH, const THash< TInt, TIntV > &CmtyVH) |
static void | GetNodeMembership (THash< TInt, TIntV > &NIDComVH, const THash< TInt, TIntV > &CmtyVH) |
static void | GetNodeMembership (THash< TInt, TIntV > &NIDComVH, const TVec< TIntV > &CmtyVV) |
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 each community) More... | |
static void | LoadCmtyVV (const TStr &InFNm, TVec< TIntV > &CmtyVV, TStrHash< TInt > &StrToNIdH, const int BeginCol, const int MinSz=3, const TSsFmt Sep=ssfTabSep) |
load bipartite community affiliation graph from text file (each row contains the member node IDs for each community) More... | |
static void | DumpCmtyVV (const TStr &OutFNm, const TVec< TIntV > &CmtyVV) |
dump bipartite community affiliation into a text file More... | |
static void | DumpCmtyVV (const TStr OutFNm, TVec< TIntV > &CmtyVV, TIntStrH &NIDNmH) |
dump bipartite community affiliation into a text file with node names More... | |
static int | TotalMemberships (const TVec< TIntV > &CmtyVV) |
total number of memberships (== sum of the sizes of communities) More... | |
static void | RewireCmtyVV (const TVec< TIntV > &CmtyVVIn, TVec< TIntV > &CmtyVVOut, TRnd &Rnd) |
rewire bipartite community affiliation graphs More... | |
static void | RewireCmtyNID (THash< TInt, TIntV > &CmtyVH, TRnd &Rnd) |
rewire bipartite community affiliation graphs More... | |
static int | Intersection (const TIntV &C1, const TIntV &C2) |
static void | GetIntersection (const THashSet< TInt > &A, const THashSet< TInt > &B, THashSet< TInt > &C) |
static int | Intersection (const THashSet< TInt > &A, const THashSet< TInt > &B) |
static double | GetConductance (const PUNGraph &Graph, const TIntSet &CmtyS, const int Edges) |
static void | GetNbhCom (const PUNGraph &Graph, const int NID, TIntSet &NBCmtyS) |
static void | SaveGephi (const TStr &OutFNm, const PUNGraph &G, const TVec< TIntV > &CmtyVVAtr, const double MaxSz, const double MinSz) |
static void | SaveGephi (const TStr &OutFNm, const PUNGraph &G, const TVec< TIntV > &CmtyVVAtr, const double MaxSz, const double MinSz, const THash< TInt, TStr > &NIDNameH) |
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) |
save graph into a gexf file which Gephi can read More... | |
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 More... | |
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 More... | |
template<class PGraph > | |
static PGraph | LoadEdgeListStr (const TStr &InFNm, TIntStrH &NIDNameH, const int &SrcColId=0, const int &DstColId=1, const TSsFmt SsFmt=ssfTabSep) |
template<class PGraph > | |
static PGraph | LoadEdgeListStr (const TStr &InFNm, TStrHash< TInt > &NodeNameH, const int &SrcColId=0, const int &DstColId=1, const TSsFmt SsFmt=ssfTabSep) |
template<class PGraph > | |
static void | GVizComGraph (const PGraph &Graph, const TVec< TIntV > &CmtyVV, const TStr &OutFNm, const TStr &Desc=TStr()) |
|
static |
Generate bipartite community affiliation from given power law coefficients for membership distribution and community size distribution.
Definition at line 131 of file agm.cpp.
References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), THashSet< TKey, THashFunc >::AddKey(), TVec< TVal, TSizeTy >::DelLast(), THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::GetDatV(), TRnd::GetUniDevInt(), IAssert, THashSet< TKey, THashFunc >::IsKey(), TVec< TVal, TSizeTy >::Last(), TVec< TVal, TSizeTy >::Len(), THashSet< TKey, THashFunc >::Len(), TPair< TVal1, TVal2 >::Val1, and TPair< TVal1, TVal2 >::Val2.
Referenced by GenCmtyVVFromPL().
dump bipartite community affiliation into a text file
Definition at line 286 of file agm.cpp.
References TStr::CStr(), and TVec< TVal, TSizeTy >::Len().
dump bipartite community affiliation into a text file with node names
Definition at line 298 of file agm.cpp.
References TStr::CStr(), THash< TKey, TDat, THashFunc >::GetDat(), THash< TKey, TDat, THashFunc >::IsKey(), and TVec< TVal, TSizeTy >::Len().
|
static |
estimate number of communities using AGM
Definition at line 544 of file agm.cpp.
References TVec< TVal, TSizeTy >::Add(), TLogRegFit::CalcLogRegNewton(), TStr::Fmt(), TAGMFit::GetCmtyVV(), TUNGraph::GetEdges(), TUNGraph::GetNodes(), TVec< TVal, TSizeTy >::GetV(), gpsLog10X, gpwLinesPoints, IAssert, TVec< TVal, TSizeTy >::Last(), TStr::Len(), TVec< TVal, TSizeTy >::Len(), TAGMFit::Likelihood(), TAGMFit::MLEGradAscentGivenCAG(), TFlt::Mn, TFlt::Mx, TMath::Round(), TAGMFit::RunMCMC(), TAGMFit::SetPNoCom(), TAGMFit::SetRegCoef(), and TPair< TVal1, TVal2 >::Val2.
|
static |
Generate bipartite community affiliation from given power law coefficients for membership distribution and community size distribution.
Definition at line 101 of file agm.cpp.
References TVec< TVal, TSizeTy >::Clr(), and TUNGraph::GetNIdV().
Referenced by GenCmtyVVFromPL(), and TAGMFit::RandomInitCmtyVV().
|
static |
Generate bipartite community affiliation from given power law coefficients for membership distribution and community size distribution.
Definition at line 112 of file agm.cpp.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Clr(), ConnectCmtyVV(), GenPLSeq(), and TVec< TVal, TSizeTy >::Len().
|
static |
Generate bipartite community affiliation from given power law coefficients for membership distribution and community size distribution.
Definition at line 92 of file agm.cpp.
References TVec< TVal, TSizeTy >::Add(), and GenCmtyVVFromPL().
|
static |
AGMUtil:: Utilities for AGM.
Generate sequence from Power law
Definition at line 81 of file agm.cpp.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Gen(), TRnd::GetPowerDev(), TVec< TVal, TSizeTy >::Len(), and TMath::Round().
Referenced by GenCmtyVVFromPL().
|
static |
Definition at line 683 of file agm.cpp.
References TUNGraph::GetEdges(), TUNGraph::GetNI(), TUNGraph::TNodeI::GetOutDeg(), TUNGraph::TNodeI::GetOutNId(), THashSet< TKey, THashFunc >::IsKey(), TUNGraph::IsNode(), and THashSet< TKey, THashFunc >::Len().
Referenced by TAGMFast::NeighborComInit(), and TAGMFit::NeighborComInit().
|
static |
Definition at line 404 of file agm.cpp.
References THashSet< TKey, THashFunc >::AddKey(), THashSet< TKey, THashFunc >::BegI(), THashSet< TKey, THashFunc >::EndI(), THashSet< TKey, THashFunc >::Gen(), THashSet< TKey, THashFunc >::IsKey(), and THashSet< TKey, THashFunc >::Len().
Referenced by TAGMFit::CalcPNoComByCmtyVV(), and TAGMFit::GetEdgeJointCom().
Definition at line 706 of file agm.cpp.
References THashSet< TKey, THashFunc >::AddKey(), THashSet< TKey, THashFunc >::Gen(), TUNGraph::TNodeI::GetDeg(), TUNGraph::TNodeI::GetNbrNId(), and TUNGraph::GetNI().
Referenced by TAGMFast::NeighborComInit(), and TAGMFit::NeighborComInit().
|
static |
get hash table of <Node ID, community IDs which node belongs to>
Definition at line 335 of file agm.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), THashSet< TKey, THashFunc >::AddKey(), THash< TKey, TDat, THashFunc >::Clr(), and TVec< TVal, TSizeTy >::Len().
Referenced by GetNodeMembership(), GVizComGraph(), TAGMFit::InitNodeData(), SaveBipartiteGephi(), and SaveGephi().
|
static |
get hash table of <Node ID, community IDs which node belongs to>. Some nodes in NIDV might belong to no community
Definition at line 347 of file agm.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), THashSet< TKey, THashFunc >::AddKey(), THash< TKey, TDat, THashFunc >::Clr(), and TVec< TVal, TSizeTy >::Len().
get hash table of <Node ID, membership size>
Definition at line 324 of file agm.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), THash< TKey, TDat, THashFunc >::BegI(), THash< TKey, TDat, THashFunc >::Clr(), and THash< TKey, TDat, THashFunc >::EndI().
|
static |
Definition at line 362 of file agm.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), THashSet< TKey, THashFunc >::AddKey(), TVec< TVal, TSizeTy >::EndI(), and TVec< TVal, TSizeTy >::Len().
|
static |
Definition at line 371 of file agm.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), THashSet< TKey, THashFunc >::AddKey(), THash< TKey, TDat, THashFunc >::BegI(), and THash< TKey, TDat, THashFunc >::EndI().
|
static |
Definition at line 381 of file agm.cpp.
References TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), THash< TKey, TDat, THashFunc >::GetKey(), and THash< TKey, TDat, THashFunc >::Len().
|
static |
Definition at line 391 of file agm.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), GetNodeMembership(), and TVec< TVal, TSizeTy >::Len().
|
inlinestatic |
Definition at line 105 of file agm.h.
References TStr::CStr(), TStr::Fmt(), THash< TKey, TDat, THashFunc >::GetDat(), TStr::GetFExt(), GetNodeMembership(), TStr::GetSubStr(), TVec< TVal, TSizeTy >::GetV(), gfDirected, TSnap::TSnapDetail::GVizDoLayout(), gvlNeato, HasGraphFlag, IAssert, TStr::Len(), and TVec< TVal, TSizeTy >::Len().
Definition at line 399 of file agm.cpp.
Referenced by TCodaAnalyzer::Net2ModeCommunities().
Definition at line 415 of file agm.cpp.
References THashSet< TKey, THashFunc >::BegI(), THashSet< TKey, THashFunc >::EndI(), THashSet< TKey, THashFunc >::IsKey(), and THashSet< TKey, THashFunc >::Len().
load bipartite community affiliation graph from text file (each row contains the member node IDs for each community)
Definition at line 246 of file agm.cpp.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Gen(), TSsParser::GetFlds(), TSsParser::GetInt(), TSsParser::IsInt(), Kilo, TVec< TVal, TSizeTy >::Len(), TSsParser::Next(), TVec< TVal, TSizeTy >::Pack(), and ssfWhiteSep.
|
static |
load bipartite community affiliation graph from text file (each row contains the member node IDs for each community)
Definition at line 266 of file agm.cpp.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Gen(), TSsParser::GetFld(), TSsParser::GetFlds(), TStrHash< TDat, TStringPool, THashFunc >::GetKeyId(), TStrHash< TDat, TStringPool, THashFunc >::IsKey(), Kilo, TVec< TVal, TSizeTy >::Len(), TSsParser::Next(), and TVec< TVal, TSizeTy >::Pack().
|
inlinestatic |
Definition at line 67 of file agm.h.
References THash< TKey, TDat, THashFunc >::AddDat(), TStrHash< TDat, TStringPool, THashFunc >::AddKey(), THash< TKey, TDat, THashFunc >::Gen(), TStrHash< TDat, TStringPool, THashFunc >::GetKey(), IAssert, THash< TKey, TDat, THashFunc >::Len(), TStrHash< TDat, TStringPool, THashFunc >::Len(), Mega, and TSsParser::Next().
|
inlinestatic |
Definition at line 86 of file agm.h.
References TStrHash< TDat, TStringPool, THashFunc >::AddKey(), Mega, TSsParser::Next(), and TStrHash< TDat, TStringPool, THashFunc >::Pack().
rewire bipartite community affiliation graphs
Definition at line 202 of file agm.cpp.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::DelLast(), THash< TKey, TDat, THashFunc >::GetKey(), TRnd::GetUniDevInt(), IAssert, THash< TKey, TDat, THashFunc >::IsKey(), TVec< TVal, TSizeTy >::Last(), THash< TKey, TDat, THashFunc >::Len(), TVec< TVal, TSizeTy >::Len(), TPair< TVal1, TVal2 >::Val1, and TPair< TVal1, TVal2 >::Val2.
Referenced by RewireCmtyVV().
|
static |
rewire bipartite community affiliation graphs
Definition at line 192 of file agm.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), THash< TKey, TDat, THashFunc >::GetDatV(), TVec< TVal, TSizeTy >::Len(), and RewireCmtyNID().
|
static |
save bipartite community affiliation into gexf file
Plot bipartite graph
Definition at line 486 of file agm.cpp.
References TStr::CStr(), THash< TKey, TDat, THashFunc >::GetDat(), GetNodeMembership(), THash< TKey, TDat, THashFunc >::IsKey(), TVec< TVal, TSizeTy >::Len(), TTriple< TVal1, TVal2, TVal3 >::Val1, TTriple< TVal1, TVal2, TVal3 >::Val2, and TTriple< TVal1, TVal2, TVal3 >::Val3.
|
inlinestatic |
Definition at line 55 of file agm.h.
Referenced by SaveGephi().
|
inlinestatic |
Definition at line 59 of file agm.h.
References SaveGephi().
|
static |
save graph into a gexf file which Gephi can read
Definition at line 428 of file agm.cpp.
References TUNGraph::BegEI(), TUNGraph::BegNI(), TStr::CStr(), TUNGraph::EndEI(), TUNGraph::EndNI(), THash< TKey, TDat, THashFunc >::GetDat(), GetNodeMembership(), THash< TKey, TDat, THashFunc >::IsKey(), TVec< TVal, TSizeTy >::Len(), TTriple< TVal1, TVal2, TVal3 >::Val1, TTriple< TVal1, TVal2, TVal3 >::Val2, and TTriple< TVal1, TVal2, TVal3 >::Val3.
total number of memberships (== sum of the sizes of communities)
Definition at line 315 of file agm.cpp.
References TVec< TVal, TSizeTy >::Len().