SNAP Library 4.1, User Reference  2018-07-26 16:30:42
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TBigNet< TNodeData, IsDir >::TNodeI Class Reference

Node iterator. More...

#include <bignet.h>

Public Member Functions

void GetInOutNIdV ()
 
int GetInVId () const
 
int GetOutVId () const
 
 TNodeI ()
 
 TNodeI (const THashIter &NodeHIter, TVPool *PoolPt)
 
 TNodeI (const TNodeI &NodeI)
 
TNodeIoperator= (const TNodeI &NI)
 
TNodeIoperator++ (int)
 Increment iterator. More...
 
bool operator< (const TNodeI &NI) const
 
bool operator== (const TNodeI &NI) const
 
int GetId () const
 
int GetDeg () const
 
int GetInDeg () const
 
int GetOutDeg () const
 
int GetInNId (const int &NodeN) const
 
int GetOutNId (const int &NodeN) const
 
int GetOutNbrId (const int &NodeN) const
 
bool IsInNId (const int &NId) const
 
bool IsOutNId (const int &NId) const
 
bool IsNbrNId (const int &NId) const
 
const TNodeData & operator() () const
 
TNodeData & operator() ()
 
const TNodeData & GetDat () const
 
TNodeData & GetDat ()
 
void Dump () const
 

Protected Types

typedef TNodeH::TIter THashIter
 

Protected Attributes

THashIter NodeHI
 
TVPoolPool
 
int InDeg
 
int OutDeg
 
int * InNIdV
 
int * OutNIdV
 

Friends

class TBigNet< TNodeData, IsDir >
 

Detailed Description

template<class TNodeData, bool IsDir>
class TBigNet< TNodeData, IsDir >::TNodeI

Node iterator.

Only forward iteration (operator++) is supported.

Definition at line 50 of file bignet.h.

Member Typedef Documentation

template<class TNodeData, bool IsDir>
typedef TNodeH::TIter TBigNet< TNodeData, IsDir >::TNodeI::THashIter
protected

Definition at line 52 of file bignet.h.

Constructor & Destructor Documentation

template<class TNodeData, bool IsDir>
TBigNet< TNodeData, IsDir >::TNodeI::TNodeI ( )
inline

Definition at line 61 of file bignet.h.

61 : NodeHI(), Pool(NULL), InDeg(0), OutDeg(0), InNIdV(NULL), OutNIdV(NULL) { }
int * OutNIdV
Definition: bignet.h:55
int * InNIdV
Definition: bignet.h:55
TVPool * Pool
Definition: bignet.h:54
THashIter NodeHI
Definition: bignet.h:53
template<class TNodeData, bool IsDir>
TBigNet< TNodeData, IsDir >::TNodeI::TNodeI ( const THashIter NodeHIter,
TVPool PoolPt 
)
inline

Definition at line 62 of file bignet.h.

62 : NodeHI(NodeHIter), Pool(PoolPt) { GetInOutNIdV(); }
void GetInOutNIdV()
Definition: bignet.h:224
TVPool * Pool
Definition: bignet.h:54
THashIter NodeHI
Definition: bignet.h:53
template<class TNodeData, bool IsDir>
TBigNet< TNodeData, IsDir >::TNodeI::TNodeI ( const TNodeI NodeI)
inline

Definition at line 63 of file bignet.h.

63 : NodeHI(NodeI.NodeHI), Pool(NodeI.Pool) { GetInOutNIdV(); }
void GetInOutNIdV()
Definition: bignet.h:224
TVPool * Pool
Definition: bignet.h:54
THashIter NodeHI
Definition: bignet.h:53

Member Function Documentation

template<class TNodeData , bool IsDir>
void TBigNet< TNodeData, IsDir >::TNodeI::Dump ( ) const

Definition at line 238 of file bignet.h.

238  {
239  printf("NodeId: %d\n", GetId());
240  printf(" I:%4d]", GetInDeg());
241  for (int i = 0; i < GetInDeg(); i++) { printf(" %d", GetInNId(i)); }
242  printf("\n O:%4d]", GetOutDeg());
243  for (int i = 0; i < GetOutDeg(); i++) { printf(" %d", GetOutNId(i)); }
244  printf("\n");
245 }
int GetOutDeg() const
Definition: bignet.h:72
int GetInDeg() const
Definition: bignet.h:71
int GetInNId(const int &NodeN) const
Definition: bignet.h:73
int GetId() const
Definition: bignet.h:69
int GetOutNId(const int &NodeN) const
Definition: bignet.h:74
template<class TNodeData, bool IsDir>
const TNodeData& TBigNet< TNodeData, IsDir >::TNodeI::GetDat ( ) const
inline

Definition at line 81 of file bignet.h.

81 { return NodeHI->Dat.Dat; }
THashIter NodeHI
Definition: bignet.h:53
template<class TNodeData, bool IsDir>
TNodeData& TBigNet< TNodeData, IsDir >::TNodeI::GetDat ( )
inline

Definition at line 82 of file bignet.h.

82 { return NodeHI->Dat.Dat; }
THashIter NodeHI
Definition: bignet.h:53
template<class TNodeData, bool IsDir>
int TBigNet< TNodeData, IsDir >::TNodeI::GetDeg ( ) const
inline

Definition at line 70 of file bignet.h.

70 { return GetInDeg()+(InNIdV!=OutNIdV?GetOutDeg():0); }
int * OutNIdV
Definition: bignet.h:55
int GetOutDeg() const
Definition: bignet.h:72
int GetInDeg() const
Definition: bignet.h:71
int * InNIdV
Definition: bignet.h:55
template<class TNodeData, bool IsDir>
int TBigNet< TNodeData, IsDir >::TNodeI::GetId ( ) const
inline

Definition at line 69 of file bignet.h.

69 { return NodeHI->Key(); }
THashIter NodeHI
Definition: bignet.h:53
template<class TNodeData, bool IsDir>
int TBigNet< TNodeData, IsDir >::TNodeI::GetInDeg ( ) const
inline

Definition at line 71 of file bignet.h.

71 { return InDeg; }
template<class TNodeData, bool IsDir>
int TBigNet< TNodeData, IsDir >::TNodeI::GetInNId ( const int &  NodeN) const
inline

Definition at line 73 of file bignet.h.

73 { return InNIdV[NodeN]; }
int * InNIdV
Definition: bignet.h:55
template<class TNodeData , bool IsDir>
void TBigNet< TNodeData, IsDir >::TNodeI::GetInOutNIdV ( )
inline

Definition at line 224 of file bignet.h.

224  {
225  if (NodeHI.IsEnd()) return;
226  const TNode& N = NodeHI->Dat;
227  if (! Pool->IsVId(N.InVId)) {
228  InDeg=0; OutDeg=0; }
229  else {
230  InDeg=Pool->GetVLen(N.InVId);
231  OutDeg=Pool->GetVLen(N.OutVId);
232  InNIdV=(int *)Pool->GetValVPt(N.InVId);
233  OutNIdV=(int *)Pool->GetValVPt(N.OutVId);
234  }
235 }
int * OutNIdV
Definition: bignet.h:55
TVal * GetValVPt(const int &VId) const
Returns pointer to the first element of the vector with id VId.
Definition: ds.h:1731
int GetVLen(const int &VId) const
Returns the number of elements in the vector with id VId.
Definition: ds.h:1729
int * InNIdV
Definition: bignet.h:55
TVPool * Pool
Definition: bignet.h:54
THashIter NodeHI
Definition: bignet.h:53
bool IsVId(const int &VId) const
Tests whether vector of id VId is in the pool.
Definition: ds.h:1709
template<class TNodeData, bool IsDir>
int TBigNet< TNodeData, IsDir >::TNodeI::GetInVId ( ) const
inline

Definition at line 58 of file bignet.h.

58 { return NodeHI->Dat.InVId; }
THashIter NodeHI
Definition: bignet.h:53
template<class TNodeData, bool IsDir>
int TBigNet< TNodeData, IsDir >::TNodeI::GetOutDeg ( ) const
inline

Definition at line 72 of file bignet.h.

72 { return OutDeg; }
template<class TNodeData, bool IsDir>
int TBigNet< TNodeData, IsDir >::TNodeI::GetOutNbrId ( const int &  NodeN) const
inline

Definition at line 75 of file bignet.h.

75 { return NodeN<OutDeg ? OutNIdV[NodeN]:InNIdV[NodeN-OutDeg]; }
int * OutNIdV
Definition: bignet.h:55
int * InNIdV
Definition: bignet.h:55
template<class TNodeData, bool IsDir>
int TBigNet< TNodeData, IsDir >::TNodeI::GetOutNId ( const int &  NodeN) const
inline

Definition at line 74 of file bignet.h.

74 { return OutNIdV[NodeN]; }
int * OutNIdV
Definition: bignet.h:55
template<class TNodeData, bool IsDir>
int TBigNet< TNodeData, IsDir >::TNodeI::GetOutVId ( ) const
inline

Definition at line 59 of file bignet.h.

59 { return NodeHI->Dat.OutVId; }
THashIter NodeHI
Definition: bignet.h:53
template<class TNodeData, bool IsDir>
bool TBigNet< TNodeData, IsDir >::TNodeI::IsInNId ( const int &  NId) const
inline

Definition at line 76 of file bignet.h.

76 { return BinSearch(InNIdV, InNIdV+InDeg, NId)!=NULL; }
int * InNIdV
Definition: bignet.h:55
static const int * BinSearch(const int *Beg, const int *End, const int &Val)
Definition: bignet.h:264
template<class TNodeData, bool IsDir>
bool TBigNet< TNodeData, IsDir >::TNodeI::IsNbrNId ( const int &  NId) const
inline

Definition at line 78 of file bignet.h.

78 { return IsOutNId(NId) || IsInNId(NId); }
bool IsOutNId(const int &NId) const
Definition: bignet.h:77
bool IsInNId(const int &NId) const
Definition: bignet.h:76
template<class TNodeData, bool IsDir>
bool TBigNet< TNodeData, IsDir >::TNodeI::IsOutNId ( const int &  NId) const
inline

Definition at line 77 of file bignet.h.

77 { return BinSearch(OutNIdV, OutNIdV+OutDeg, NId)!=NULL; }
int * OutNIdV
Definition: bignet.h:55
static const int * BinSearch(const int *Beg, const int *End, const int &Val)
Definition: bignet.h:264
template<class TNodeData, bool IsDir>
const TNodeData& TBigNet< TNodeData, IsDir >::TNodeI::operator() ( ) const
inline

Definition at line 79 of file bignet.h.

79 { return GetDat(); }
const TNodeData & GetDat() const
Definition: bignet.h:81
template<class TNodeData, bool IsDir>
TNodeData& TBigNet< TNodeData, IsDir >::TNodeI::operator() ( )
inline

Definition at line 80 of file bignet.h.

80 { return GetDat(); }
const TNodeData & GetDat() const
Definition: bignet.h:81
template<class TNodeData, bool IsDir>
TNodeI& TBigNet< TNodeData, IsDir >::TNodeI::operator++ ( int  )
inline

Increment iterator.

Definition at line 66 of file bignet.h.

66 { NodeHI++; GetInOutNIdV(); return *this; }
void GetInOutNIdV()
Definition: bignet.h:224
THashIter NodeHI
Definition: bignet.h:53
template<class TNodeData, bool IsDir>
bool TBigNet< TNodeData, IsDir >::TNodeI::operator< ( const TNodeI NI) const
inline

Definition at line 67 of file bignet.h.

67 { return NodeHI < NI.NodeHI; }
THashIter NodeHI
Definition: bignet.h:53
template<class TNodeData, bool IsDir>
TNodeI& TBigNet< TNodeData, IsDir >::TNodeI::operator= ( const TNodeI NI)
inline

Definition at line 64 of file bignet.h.

64 { NodeHI=NI.NodeHI; Pool=NI.Pool; GetInOutNIdV(); return *this; }
void GetInOutNIdV()
Definition: bignet.h:224
TVPool * Pool
Definition: bignet.h:54
THashIter NodeHI
Definition: bignet.h:53
template<class TNodeData, bool IsDir>
bool TBigNet< TNodeData, IsDir >::TNodeI::operator== ( const TNodeI NI) const
inline

Definition at line 68 of file bignet.h.

68 { return NodeHI == NI.NodeHI; }
THashIter NodeHI
Definition: bignet.h:53

Friends And Related Function Documentation

template<class TNodeData, bool IsDir>
friend class TBigNet< TNodeData, IsDir >
friend

Definition at line 91 of file bignet.h.

Member Data Documentation

template<class TNodeData, bool IsDir>
int TBigNet< TNodeData, IsDir >::TNodeI::InDeg
protected

Definition at line 55 of file bignet.h.

template<class TNodeData, bool IsDir>
int * TBigNet< TNodeData, IsDir >::TNodeI::InNIdV
protected

Definition at line 55 of file bignet.h.

template<class TNodeData, bool IsDir>
THashIter TBigNet< TNodeData, IsDir >::TNodeI::NodeHI
protected

Definition at line 53 of file bignet.h.

template<class TNodeData, bool IsDir>
int TBigNet< TNodeData, IsDir >::TNodeI::OutDeg
protected

Definition at line 55 of file bignet.h.

template<class TNodeData, bool IsDir>
int * TBigNet< TNodeData, IsDir >::TNodeI::OutNIdV
protected

Definition at line 55 of file bignet.h.

template<class TNodeData, bool IsDir>
TVPool* TBigNet< TNodeData, IsDir >::TNodeI::Pool
protected

Definition at line 54 of file bignet.h.


The documentation for this class was generated from the following file: