SNAP Library 6.0, Developer Reference
2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <anf.h>
Public Member Functions | |
TGraphAnf (const PGraph &GraphPt, const int &Approx=32, const int &moreBits=5, const int &RndSeed=0) | |
uint64 | GetNIdOffset (const int &NId) const |
void | InitAnfBits (TAnfBitV &BitV) |
void | Union (TAnfBitV &BitV1, const uint64 &NId1Offset, TAnfBitV &BitV2, const uint64 &NId2Offset) const |
double | AvgLstZero (const TAnfBitV &BitV, const uint64 &NIdOffset) const |
double | GetCount (const TAnfBitV &BitV, const uint64 &NIdOffset) const |
void | GetNodeAnf (const int &SrcNId, TIntFltKdV &DistNbrsV, const int &MxDist, const bool &IsDir) |
void | GetGraphAnf (TIntFltKdV &DistNbrsV, const int &MxDist, const bool &IsDir) |
Private Types | |
typedef TVec< uint64 > | TAnfBitV |
Private Member Functions | |
UndefDefaultCopyAssign (TGraphAnf) | |
Private Attributes | |
THash< TInt, uint64 > | NIdToBitPosH |
TInt | NApprox |
TInt | NBits |
TInt | MoreBits |
TInt | ApproxBytes |
PGraph | Graph |
TRnd | Rnd |
Approximate Neighborhood Function. Implements the algorithm for computing the diameter of a given graph. The method is based on the approximate counting argument by Flajolet-Martin. For more details see C. R. Palmer, P. B. Gibbons and C. Faloutsos, ANF: A Fast and Scalable Tool for Data Mining in Massive Graphs, KDD 2002 (http://www.cs.cmu.edu/~christos/PUBLICATIONS/kdd02-anf.ps.gz) See TSnap::TestAnf() for example of how to use the class.
|
inline |
double TGraphAnf< PGraph >::AvgLstZero | ( | const TAnfBitV & | BitV, |
const uint64 & | NIdOffset | ||
) | const |
Definition at line 107 of file anf.h.
References TVec< TVal, TSizeTy >::BegI().
Referenced by TGraphAnf< PGraph >::GetCount().
|
inline |
Definition at line 50 of file anf.h.
References TGraphAnf< PGraph >::AvgLstZero().
void TGraphAnf< PGraph >::GetGraphAnf | ( | TIntFltKdV & | DistNbrsV, |
const int & | MxDist, | ||
const bool & | IsDir | ||
) |
Returns the number of pairs of nodes reachable in less than H hops. For example, DistNbrsV.GetDat(0) is the number of nodes in the graph, DistNbrsV.GetDat(1) is the number of nodes+edges and so on.
DistNbrsV | Maps between the distance H (in hops) and the number of nodes reachable in <=H hops. |
MxDist | Maximum number of hops the algorithm spreads from SrcNId. |
IsDir | false: consider links as undirected (drop link directions). |
Definition at line 148 of file anf.h.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::BegI(), TVec< TVal, TSizeTy >::Clr(), TVec< TVal, TSizeTy >::Gen(), IAssert, TVec< TVal, TSizeTy >::LastLast(), TVec< TVal, TSizeTy >::Len(), and TInt::Mx.
Referenced by TSnap::GetAnf(), TSnap::GetAnfEffDiam(), and TSnap::TestAnf().
Definition at line 46 of file anf.h.
References THash< TKey, TDat, THashFunc >::GetDat().
void TGraphAnf< PGraph >::GetNodeAnf | ( | const int & | SrcNId, |
TIntFltKdV & | DistNbrsV, | ||
const int & | MxDist, | ||
const bool & | IsDir | ||
) |
Returns the number of nodes reachable from SrcNId in less than H hops.
SrcNId | Starting node. |
DistNbrsV | Maps between the distance H (in hops) and the number of nodes reachable in <=H hops. |
MxDist | Maximum number of hops the algorithm spreads from SrcNId. |
IsDir | false: consider links as undirected (drop link directions). |
Definition at line 120 of file anf.h.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::BegI(), TVec< TVal, TSizeTy >::Clr(), TVec< TVal, TSizeTy >::Gen(), IAssert, TVec< TVal, TSizeTy >::Last(), TVec< TVal, TSizeTy >::Len(), and TInt::Mx.
Referenced by TSnap::GetAnf().
Definition at line 67 of file anf.h.
References TVec< TVal, TSizeTy >::BegI(), TStr::Fmt(), TVec< TVal, TSizeTy >::Gen(), TUInt64::GetStr(), IAssert, IAssertR, TMath::Log2(), TInt::Mx, and TVec< TVal, TSizeTy >::PutAll().
void TGraphAnf< PGraph >::Union | ( | TAnfBitV & | BitV1, |
const uint64 & | NId1Offset, | ||
TAnfBitV & | BitV2, | ||
const uint64 & | NId2Offset | ||
) | const |
Definition at line 99 of file anf.h.
References TVec< TVal, TSizeTy >::BegI().
|
private |