SNAP Library 2.1, User Reference  2013-09-25 10:47:25
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI Class Reference

Node iterator. Only forward iteration (operator++) is supported. More...

#include <network.h>

List of all members.

Public Member Functions

 TNodeI ()
 TNodeI (const THashIter &NodeHIter, const TNodeEdgeNet *NetPt)
 TNodeI (const TNodeI &NodeI)
TNodeIoperator= (const TNodeI &NodeI)
TNodeIoperator++ (int)
 Increment iterator.
bool operator< (const TNodeI &NodeI) const
bool operator== (const TNodeI &NodeI) const
int GetId () const
 Returns ID of the current node.
int GetDeg () const
 Returns degree of the current node, the sum of in-degree and out-degree.
int GetInDeg () const
 Returns in-degree of the current node.
int GetOutDeg () const
 Returns out-degree of the current node.
int GetInNId (const int &EdgeN) const
 Returns ID of EdgeN-th in-node (the node pointing to the current node).
int GetOutNId (const int &EdgeN) const
 Returns ID of EdgeN-th out-node (the node the current node points to).
int GetNbrNId (const int &EdgeN) const
 Returns ID of EdgeN-th neighboring node.
bool IsInNId (const int &NId) const
 Tests whether node with ID NId points to the current node.
bool IsOutNId (const int &NId) const
 Tests whether the current node points to node with ID NId.
bool IsNbrNId (const int &NId) const
 Tests whether node with ID NId is a neighbor of the current node.
const TNodeData & operator() () const
TNodeData & operator() ()
const TNodeData & GetDat () const
TNodeData & GetDat ()
const TNodeData & GetInNDat (const int &EdgeN) const
TNodeData & GetInNDat (const int &EdgeN)
const TNodeData & GetOutNDat (const int &EdgeN) const
TNodeData & GetOutNDat (const int &EdgeN)
const TNodeData & GetNbrNDat (const int &EdgeN) const
TNodeData & GetNbrNDat (const int &EdgeN)
int GetInEId (const int &EdgeN) const
 Returns ID of EdgeN-th in-edge.
int GetOutEId (const int &EdgeN) const
 Returns ID of EdgeN-th out-edge.
int GetNbrEId (const int &EdgeN) const
 Returns ID of EdgeN-th in or out-edge.
bool IsInEId (const int &EId) const
 Tests whether the edge with ID EId is an in-edge of current node.
bool IsOutEId (const int &EId) const
 Tests whether the edge with ID EId is an out-edge of current node.
bool IsNbrEId (const int &EId) const
 Tests whether the edge with ID EId is an in or out-edge of current node.
TEdgeDatGetInEDat (const int &EdgeN)
const TEdgeDatGetInEDat (const int &EdgeN) const
TEdgeDatGetOutEDat (const int &EdgeN)
const TEdgeDatGetOutEDat (const int &EdgeN) const
TEdgeDatGetNbrEDat (const int &EdgeN)
const TEdgeDatGetNbrEDat (const int &EdgeN) const

Private Types

typedef THash< TInt, TNode >::TIter THashIter

Private Attributes

THashIter NodeHI
TNodeEdgeNetNet

Friends

class TNodeEdgeNet

Detailed Description

template<class TNodeData, class TEdgeData>
class TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI

Node iterator. Only forward iteration (operator++) is supported.

Definition at line 1034 of file network.h.


Member Typedef Documentation

template<class TNodeData, class TEdgeData>
typedef THash<TInt, TNode>::TIter TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::THashIter [private]

Definition at line 1036 of file network.h.


Constructor & Destructor Documentation

template<class TNodeData, class TEdgeData>
TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::TNodeI ( ) [inline]

Definition at line 1040 of file network.h.

: NodeHI(), Net(NULL) { }
template<class TNodeData, class TEdgeData>
TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::TNodeI ( const THashIter NodeHIter,
const TNodeEdgeNet NetPt 
) [inline]

Definition at line 1041 of file network.h.

: NodeHI(NodeHIter), Net((TNodeEdgeNet *)NetPt) { }
template<class TNodeData, class TEdgeData>
TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::TNodeI ( const TNodeI NodeI) [inline]

Definition at line 1042 of file network.h.

: NodeHI(NodeI.NodeHI), Net(NodeI.Net) { }

Member Function Documentation

template<class TNodeData, class TEdgeData>
const TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetDat ( ) const [inline]

Definition at line 1078 of file network.h.

{ return NodeHI.GetDat().GetDat(); }
template<class TNodeData, class TEdgeData>
TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetDat ( ) [inline]

Definition at line 1079 of file network.h.

{ return NodeHI.GetDat().GetDat(); }
template<class TNodeData, class TEdgeData>
int TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetDeg ( ) const [inline]

Returns degree of the current node, the sum of in-degree and out-degree.

Definition at line 1051 of file network.h.

{ return NodeHI.GetDat().GetDeg(); }
template<class TNodeData, class TEdgeData>
int TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetId ( ) const [inline]

Returns ID of the current node.

Definition at line 1049 of file network.h.

{ return NodeHI.GetDat().GetId(); }
template<class TNodeData, class TEdgeData>
int TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetInDeg ( ) const [inline]

Returns in-degree of the current node.

Definition at line 1053 of file network.h.

{ return NodeHI.GetDat().GetInDeg(); }
template<class TNodeData, class TEdgeData>
TEdgeDat& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetInEDat ( const int &  EdgeN) [inline]

Definition at line 1100 of file network.h.

{ return Net->GetEDat(GetInEId(EdgeN)); }
template<class TNodeData, class TEdgeData>
const TEdgeDat& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetInEDat ( const int &  EdgeN) const [inline]

Definition at line 1101 of file network.h.

{ return Net->GetEDat(GetInEId(EdgeN)); }
template<class TNodeData, class TEdgeData>
int TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetInEId ( const int &  EdgeN) const [inline]

Returns ID of EdgeN-th in-edge.

Definition at line 1088 of file network.h.

{ return NodeHI.GetDat().GetInEId(EdgeN); }
template<class TNodeData, class TEdgeData>
const TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetInNDat ( const int &  EdgeN) const [inline]

Definition at line 1080 of file network.h.

{ return Net->GetNDat(GetInNId(EdgeN)); }
template<class TNodeData, class TEdgeData>
TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetInNDat ( const int &  EdgeN) [inline]

Definition at line 1081 of file network.h.

{ return Net->GetNodeDat(GetInNId(EdgeN)); }
template<class TNodeData, class TEdgeData>
int TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetInNId ( const int &  EdgeN) const [inline]

Returns ID of EdgeN-th in-node (the node pointing to the current node).

Range of NodeN: 0 <= NodeN < GetInDeg().

Definition at line 1059 of file network.h.

{ return Net->GetEdge(NodeHI.GetDat().GetInEId(EdgeN)).GetSrcNId(); }
template<class TNodeData, class TEdgeData>
TEdgeDat& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetNbrEDat ( const int &  EdgeN) [inline]

Definition at line 1104 of file network.h.

{ return Net->GetEDat(GetNbrEId(EdgeN)); }
template<class TNodeData, class TEdgeData>
const TEdgeDat& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetNbrEDat ( const int &  EdgeN) const [inline]

Definition at line 1105 of file network.h.

{ return Net->GetEDat(GetNbrEId(EdgeN)); }
template<class TNodeData, class TEdgeData>
int TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetNbrEId ( const int &  EdgeN) const [inline]

Returns ID of EdgeN-th in or out-edge.

Definition at line 1092 of file network.h.

{ return NodeHI.GetDat().GetNbrEId(EdgeN); }
template<class TNodeData, class TEdgeData>
const TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetNbrNDat ( const int &  EdgeN) const [inline]

Definition at line 1084 of file network.h.

{ return Net->GetNDat(GetNbrNId(EdgeN)); }
template<class TNodeData, class TEdgeData>
TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetNbrNDat ( const int &  EdgeN) [inline]

Definition at line 1085 of file network.h.

{ return Net->GetNDat(GetNbrNId(EdgeN)); }
template<class TNodeData, class TEdgeData>
int TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetNbrNId ( const int &  EdgeN) const [inline]

Returns ID of EdgeN-th neighboring node.

Range of NodeN: 0 <= NodeN < GetNbrDeg().

Definition at line 1067 of file network.h.

                                          { const TEdge& E = Net->GetEdge(NodeHI.GetDat().GetNbrEId(EdgeN));
      return GetId()==E.GetSrcNId() ? E.GetDstNId():E.GetSrcNId(); }
template<class TNodeData, class TEdgeData>
int TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetOutDeg ( ) const [inline]

Returns out-degree of the current node.

Definition at line 1055 of file network.h.

{ return NodeHI.GetDat().GetOutDeg(); }
template<class TNodeData, class TEdgeData>
TEdgeDat& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetOutEDat ( const int &  EdgeN) [inline]

Definition at line 1102 of file network.h.

{ return Net->GetEDat(GetOutEId(EdgeN)); }
template<class TNodeData, class TEdgeData>
const TEdgeDat& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetOutEDat ( const int &  EdgeN) const [inline]

Definition at line 1103 of file network.h.

{ return Net->GetEDat(GetOutEId(EdgeN)); }
template<class TNodeData, class TEdgeData>
int TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetOutEId ( const int &  EdgeN) const [inline]

Returns ID of EdgeN-th out-edge.

Definition at line 1090 of file network.h.

{ return NodeHI.GetDat().GetOutEId(EdgeN); }
template<class TNodeData, class TEdgeData>
const TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetOutNDat ( const int &  EdgeN) const [inline]

Definition at line 1082 of file network.h.

{ return Net->GetNDat(GetOutNId(EdgeN)); }
template<class TNodeData, class TEdgeData>
TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetOutNDat ( const int &  EdgeN) [inline]

Definition at line 1083 of file network.h.

{ return Net->GetNDat(GetOutNId(EdgeN)); }
template<class TNodeData, class TEdgeData>
int TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetOutNId ( const int &  EdgeN) const [inline]

Returns ID of EdgeN-th out-node (the node the current node points to).

Range of NodeN: 0 <= NodeN < GetOutDeg().

Definition at line 1063 of file network.h.

{ return Net->GetEdge(NodeHI.GetDat().GetOutEId(EdgeN)).GetDstNId(); }
template<class TNodeData, class TEdgeData>
bool TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::IsInEId ( const int &  EId) const [inline]

Tests whether the edge with ID EId is an in-edge of current node.

Definition at line 1094 of file network.h.

{ return NodeHI.GetDat().IsInEId(EId); }
template<class TNodeData , class TEdgeData >
bool TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::IsInNId ( const int &  NId) const

Tests whether node with ID NId points to the current node.

Definition at line 1321 of file network.h.

                                                                           {
  const TNode& Node = NodeHI.GetDat();
  for (int edge = 0; edge < Node.GetInDeg(); edge++) {
    if (NId == Net->GetEdge(Node.GetInEId(edge)).GetSrcNId())
      return true;
  }
  return false;
}
template<class TNodeData, class TEdgeData>
bool TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::IsNbrEId ( const int &  EId) const [inline]

Tests whether the edge with ID EId is an in or out-edge of current node.

Definition at line 1098 of file network.h.

{ return NodeHI.GetDat().IsNbrEId(EId); }
template<class TNodeData, class TEdgeData>
bool TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::IsNbrNId ( const int &  NId) const [inline]

Tests whether node with ID NId is a neighbor of the current node.

Definition at line 1074 of file network.h.

{ return IsOutNId(NId) || IsInNId(NId); }
template<class TNodeData, class TEdgeData>
bool TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::IsOutEId ( const int &  EId) const [inline]

Tests whether the edge with ID EId is an out-edge of current node.

Definition at line 1096 of file network.h.

{ return NodeHI.GetDat().IsOutEId(EId); }
template<class TNodeData , class TEdgeData >
bool TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::IsOutNId ( const int &  NId) const

Tests whether the current node points to node with ID NId.

Definition at line 1331 of file network.h.

                                                                            {
  const TNode& Node = NodeHI.GetDat();
  for (int edge = 0; edge < Node.GetOutDeg(); edge++) {
    if (NId == Net->GetEdge(Node.GetOutEId(edge)).GetDstNId())
      return true;
  }
  return false;
}
template<class TNodeData, class TEdgeData>
const TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::operator() ( ) const [inline]

Definition at line 1076 of file network.h.

{ return NodeHI.GetDat().GetDat(); }
template<class TNodeData, class TEdgeData>
TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::operator() ( ) [inline]

Definition at line 1077 of file network.h.

{ return NodeHI.GetDat().GetDat(); }
template<class TNodeData, class TEdgeData>
TNodeI& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::operator++ ( int  ) [inline]

Increment iterator.

Definition at line 1045 of file network.h.

{ NodeHI++;  return *this; }
template<class TNodeData, class TEdgeData>
bool TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::operator< ( const TNodeI NodeI) const [inline]

Definition at line 1046 of file network.h.

{ return NodeHI < NodeI.NodeHI; }
template<class TNodeData, class TEdgeData>
TNodeI& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::operator= ( const TNodeI NodeI) [inline]

Definition at line 1043 of file network.h.

{ NodeHI = NodeI.NodeHI;  Net=NodeI.Net;  return *this; }
template<class TNodeData, class TEdgeData>
bool TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::operator== ( const TNodeI NodeI) const [inline]

Definition at line 1047 of file network.h.

{ return NodeHI == NodeI.NodeHI; }

Friends And Related Function Documentation

template<class TNodeData, class TEdgeData>
friend class TNodeEdgeNet [friend]

Definition at line 1106 of file network.h.


Member Data Documentation

template<class TNodeData, class TEdgeData>
TNodeEdgeNet* TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::Net [private]

Definition at line 1038 of file network.h.

template<class TNodeData, class TEdgeData>
THashIter TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::NodeHI [private]

Definition at line 1037 of file network.h.


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