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
TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI Class Reference

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

#include <network.h>

Public Member Functions

 TNodeI ()
 
 TNodeI (const THashIter &NodeHIter, const TNodeEdgeNet *NetPt)
 
 TNodeI (const TNodeI &NodeI)
 
TNodeIoperator= (const TNodeI &NodeI)
 
TNodeIoperator++ (int)
 Increment iterator. More...
 
bool operator< (const TNodeI &NodeI) const
 
bool operator== (const TNodeI &NodeI) const
 
int GetId () const
 Returns ID of the current node. More...
 
int GetDeg () const
 Returns degree of the current node, the sum of in-degree and out-degree. More...
 
int GetInDeg () const
 Returns in-degree of the current node. More...
 
int GetOutDeg () const
 Returns out-degree of the current node. More...
 
int GetInNId (const int &EdgeN) const
 Returns ID of EdgeN-th in-node (the node pointing to the current node). More...
 
int GetOutNId (const int &EdgeN) const
 Returns ID of EdgeN-th out-node (the node the current node points to). More...
 
int GetNbrNId (const int &EdgeN) const
 Returns ID of EdgeN-th neighboring node. More...
 
bool IsInNId (const int &NId) const
 Tests whether node with ID NId points to the current node. More...
 
bool IsOutNId (const int &NId) const
 Tests whether the current node points to node with ID NId. More...
 
bool IsNbrNId (const int &NId) const
 Tests whether node with ID NId is a neighbor of the current node. More...
 
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. More...
 
int GetOutEId (const int &EdgeN) const
 Returns ID of EdgeN-th out-edge. More...
 
int GetNbrEId (const int &EdgeN) const
 Returns ID of EdgeN-th in or out-edge. More...
 
bool IsInEId (const int &EId) const
 Tests whether the edge with ID EId is an in-edge of current node. More...
 
bool IsOutEId (const int &EId) const
 Tests whether the edge with ID EId is an out-edge of current node. More...
 
bool IsNbrEId (const int &EId) const
 Tests whether the edge with ID EId is an in or out-edge of current node. More...
 
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 1143 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 1145 of file network.h.

Constructor & Destructor Documentation

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

Definition at line 1149 of file network.h.

1149 : NodeHI(), Net(NULL) { }
THashIter NodeHI
Definition: network.h:1146
TNodeEdgeNet * Net
Definition: network.h:1147
template<class TNodeData, class TEdgeData>
TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::TNodeI ( const THashIter NodeHIter,
const TNodeEdgeNet NetPt 
)
inline

Definition at line 1150 of file network.h.

1150 : NodeHI(NodeHIter), Net((TNodeEdgeNet *)NetPt) { }
Node Edge Network (directed multigraph, TNEGraph with data on nodes and edges).
Definition: network.h:1074
THashIter NodeHI
Definition: network.h:1146
TNodeEdgeNet * Net
Definition: network.h:1147
template<class TNodeData, class TEdgeData>
TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::TNodeI ( const TNodeI NodeI)
inline

Definition at line 1151 of file network.h.

1151 : NodeHI(NodeI.NodeHI), Net(NodeI.Net) { }
THashIter NodeHI
Definition: network.h:1146
TNodeEdgeNet * Net
Definition: network.h:1147

Member Function Documentation

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

Definition at line 1187 of file network.h.

1187 { return NodeHI.GetDat().GetDat(); }
THashIter NodeHI
Definition: network.h:1146
template<class TNodeData, class TEdgeData>
TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetDat ( )
inline

Definition at line 1188 of file network.h.

1188 { return NodeHI.GetDat().GetDat(); }
THashIter NodeHI
Definition: network.h:1146
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 1160 of file network.h.

1160 { return NodeHI.GetDat().GetDeg(); }
THashIter NodeHI
Definition: network.h:1146
template<class TNodeData, class TEdgeData>
int TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetId ( ) const
inline

Returns ID of the current node.

Definition at line 1158 of file network.h.

1158 { return NodeHI.GetDat().GetId(); }
THashIter NodeHI
Definition: network.h:1146
template<class TNodeData, class TEdgeData>
int TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetInDeg ( ) const
inline

Returns in-degree of the current node.

Definition at line 1162 of file network.h.

1162 { return NodeHI.GetDat().GetInDeg(); }
THashIter NodeHI
Definition: network.h:1146
template<class TNodeData, class TEdgeData>
TEdgeDat& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetInEDat ( const int &  EdgeN)
inline

Definition at line 1209 of file network.h.

1209 { return Net->GetEDat(GetInEId(EdgeN)); }
int GetInEId(const int &EdgeN) const
Returns ID of EdgeN-th in-edge.
Definition: network.h:1197
TEdgeData & GetEDat(const int &EId)
Returns edge data for the edge with ID EId.
Definition: network.h:1399
TNodeEdgeNet * Net
Definition: network.h:1147
template<class TNodeData, class TEdgeData>
const TEdgeDat& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetInEDat ( const int &  EdgeN) const
inline

Definition at line 1210 of file network.h.

1210 { return Net->GetEDat(GetInEId(EdgeN)); }
int GetInEId(const int &EdgeN) const
Returns ID of EdgeN-th in-edge.
Definition: network.h:1197
TEdgeData & GetEDat(const int &EId)
Returns edge data for the edge with ID EId.
Definition: network.h:1399
TNodeEdgeNet * Net
Definition: network.h:1147
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 1197 of file network.h.

1197 { return NodeHI.GetDat().GetInEId(EdgeN); }
THashIter NodeHI
Definition: network.h:1146
template<class TNodeData, class TEdgeData>
const TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetInNDat ( const int &  EdgeN) const
inline

Definition at line 1189 of file network.h.

1189 { return Net->GetNDat(GetInNId(EdgeN)); }
int GetInNId(const int &EdgeN) const
Returns ID of EdgeN-th in-node (the node pointing to the current node).
Definition: network.h:1168
TNodeData & GetNDat(const int &NId)
Returns node data for the node of ID NId in the network.
Definition: network.h:1346
TNodeEdgeNet * Net
Definition: network.h:1147
template<class TNodeData, class TEdgeData>
TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetInNDat ( const int &  EdgeN)
inline

Definition at line 1190 of file network.h.

1190 { return Net->GetNDat(GetInNId(EdgeN)); }
int GetInNId(const int &EdgeN) const
Returns ID of EdgeN-th in-node (the node pointing to the current node).
Definition: network.h:1168
TNodeData & GetNDat(const int &NId)
Returns node data for the node of ID NId in the network.
Definition: network.h:1346
TNodeEdgeNet * Net
Definition: network.h:1147
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 1168 of file network.h.

1168 { return Net->GetEdge(NodeHI.GetDat().GetInEId(EdgeN)).GetSrcNId(); }
THashIter NodeHI
Definition: network.h:1146
TNodeEdgeNet * Net
Definition: network.h:1147
TEdge & GetEdge(const int &EId)
Definition: network.h:1253
template<class TNodeData, class TEdgeData>
TEdgeDat& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetNbrEDat ( const int &  EdgeN)
inline

Definition at line 1213 of file network.h.

1213 { return Net->GetEDat(GetNbrEId(EdgeN)); }
int GetNbrEId(const int &EdgeN) const
Returns ID of EdgeN-th in or out-edge.
Definition: network.h:1201
TEdgeData & GetEDat(const int &EId)
Returns edge data for the edge with ID EId.
Definition: network.h:1399
TNodeEdgeNet * Net
Definition: network.h:1147
template<class TNodeData, class TEdgeData>
const TEdgeDat& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetNbrEDat ( const int &  EdgeN) const
inline

Definition at line 1214 of file network.h.

1214 { return Net->GetEDat(GetNbrEId(EdgeN)); }
int GetNbrEId(const int &EdgeN) const
Returns ID of EdgeN-th in or out-edge.
Definition: network.h:1201
TEdgeData & GetEDat(const int &EId)
Returns edge data for the edge with ID EId.
Definition: network.h:1399
TNodeEdgeNet * Net
Definition: network.h:1147
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 1201 of file network.h.

1201 { return NodeHI.GetDat().GetNbrEId(EdgeN); }
THashIter NodeHI
Definition: network.h:1146
template<class TNodeData, class TEdgeData>
const TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetNbrNDat ( const int &  EdgeN) const
inline

Definition at line 1193 of file network.h.

1193 { return Net->GetNDat(GetNbrNId(EdgeN)); }
int GetNbrNId(const int &EdgeN) const
Returns ID of EdgeN-th neighboring node.
Definition: network.h:1176
TNodeData & GetNDat(const int &NId)
Returns node data for the node of ID NId in the network.
Definition: network.h:1346
TNodeEdgeNet * Net
Definition: network.h:1147
template<class TNodeData, class TEdgeData>
TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetNbrNDat ( const int &  EdgeN)
inline

Definition at line 1194 of file network.h.

1194 { return Net->GetNDat(GetNbrNId(EdgeN)); }
int GetNbrNId(const int &EdgeN) const
Returns ID of EdgeN-th neighboring node.
Definition: network.h:1176
TNodeData & GetNDat(const int &NId)
Returns node data for the node of ID NId in the network.
Definition: network.h:1346
TNodeEdgeNet * Net
Definition: network.h:1147
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 1176 of file network.h.

1176  { const TEdge& E = Net->GetEdge(NodeHI.GetDat().GetNbrEId(EdgeN));
1177  return GetId()==E.GetSrcNId() ? E.GetDstNId():E.GetSrcNId(); }
THashIter NodeHI
Definition: network.h:1146
TNodeEdgeNet * Net
Definition: network.h:1147
TEdge & GetEdge(const int &EId)
Definition: network.h:1253
int GetId() const
Returns ID of the current node.
Definition: network.h:1158
template<class TNodeData, class TEdgeData>
int TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetOutDeg ( ) const
inline

Returns out-degree of the current node.

Definition at line 1164 of file network.h.

1164 { return NodeHI.GetDat().GetOutDeg(); }
THashIter NodeHI
Definition: network.h:1146
template<class TNodeData, class TEdgeData>
TEdgeDat& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetOutEDat ( const int &  EdgeN)
inline

Definition at line 1211 of file network.h.

1211 { return Net->GetEDat(GetOutEId(EdgeN)); }
int GetOutEId(const int &EdgeN) const
Returns ID of EdgeN-th out-edge.
Definition: network.h:1199
TEdgeData & GetEDat(const int &EId)
Returns edge data for the edge with ID EId.
Definition: network.h:1399
TNodeEdgeNet * Net
Definition: network.h:1147
template<class TNodeData, class TEdgeData>
const TEdgeDat& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetOutEDat ( const int &  EdgeN) const
inline

Definition at line 1212 of file network.h.

1212 { return Net->GetEDat(GetOutEId(EdgeN)); }
int GetOutEId(const int &EdgeN) const
Returns ID of EdgeN-th out-edge.
Definition: network.h:1199
TEdgeData & GetEDat(const int &EId)
Returns edge data for the edge with ID EId.
Definition: network.h:1399
TNodeEdgeNet * Net
Definition: network.h:1147
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 1199 of file network.h.

1199 { return NodeHI.GetDat().GetOutEId(EdgeN); }
THashIter NodeHI
Definition: network.h:1146
template<class TNodeData, class TEdgeData>
const TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetOutNDat ( const int &  EdgeN) const
inline

Definition at line 1191 of file network.h.

1191 { return Net->GetNDat(GetOutNId(EdgeN)); }
int GetOutNId(const int &EdgeN) const
Returns ID of EdgeN-th out-node (the node the current node points to).
Definition: network.h:1172
TNodeData & GetNDat(const int &NId)
Returns node data for the node of ID NId in the network.
Definition: network.h:1346
TNodeEdgeNet * Net
Definition: network.h:1147
template<class TNodeData, class TEdgeData>
TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::GetOutNDat ( const int &  EdgeN)
inline

Definition at line 1192 of file network.h.

1192 { return Net->GetNDat(GetOutNId(EdgeN)); }
int GetOutNId(const int &EdgeN) const
Returns ID of EdgeN-th out-node (the node the current node points to).
Definition: network.h:1172
TNodeData & GetNDat(const int &NId)
Returns node data for the node of ID NId in the network.
Definition: network.h:1346
TNodeEdgeNet * Net
Definition: network.h:1147
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 1172 of file network.h.

1172 { return Net->GetEdge(NodeHI.GetDat().GetOutEId(EdgeN)).GetDstNId(); }
THashIter NodeHI
Definition: network.h:1146
TNodeEdgeNet * Net
Definition: network.h:1147
TEdge & GetEdge(const int &EId)
Definition: network.h:1253
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 1203 of file network.h.

1203 { return NodeHI.GetDat().IsInEId(EId); }
THashIter NodeHI
Definition: network.h:1146
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 1463 of file network.h.

1463  {
1464  const TNode& Node = NodeHI.GetDat();
1465  for (int edge = 0; edge < Node.GetInDeg(); edge++) {
1466  if (NId == Net->GetEdge(Node.GetInEId(edge)).GetSrcNId())
1467  return true;
1468  }
1469  return false;
1470 }
THashIter NodeHI
Definition: network.h:1146
TNodeEdgeNet * Net
Definition: network.h:1147
TEdge & GetEdge(const int &EId)
Definition: network.h:1253
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 1207 of file network.h.

1207 { return NodeHI.GetDat().IsNbrEId(EId); }
THashIter NodeHI
Definition: network.h:1146
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 1183 of file network.h.

1183 { return IsOutNId(NId) || IsInNId(NId); }
bool IsOutNId(const int &NId) const
Tests whether the current node points to node with ID NId.
Definition: network.h:1473
bool IsInNId(const int &NId) const
Tests whether node with ID NId points to the current node.
Definition: network.h:1463
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 1205 of file network.h.

1205 { return NodeHI.GetDat().IsOutEId(EId); }
THashIter NodeHI
Definition: network.h:1146
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 1473 of file network.h.

1473  {
1474  const TNode& Node = NodeHI.GetDat();
1475  for (int edge = 0; edge < Node.GetOutDeg(); edge++) {
1476  if (NId == Net->GetEdge(Node.GetOutEId(edge)).GetDstNId())
1477  return true;
1478  }
1479  return false;
1480 }
THashIter NodeHI
Definition: network.h:1146
TNodeEdgeNet * Net
Definition: network.h:1147
TEdge & GetEdge(const int &EId)
Definition: network.h:1253
template<class TNodeData, class TEdgeData>
const TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::operator() ( ) const
inline

Definition at line 1185 of file network.h.

1185 { return NodeHI.GetDat().GetDat(); }
THashIter NodeHI
Definition: network.h:1146
template<class TNodeData, class TEdgeData>
TNodeData& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::operator() ( )
inline

Definition at line 1186 of file network.h.

1186 { return NodeHI.GetDat().GetDat(); }
THashIter NodeHI
Definition: network.h:1146
template<class TNodeData, class TEdgeData>
TNodeI& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::operator++ ( int  )
inline

Increment iterator.

Definition at line 1154 of file network.h.

1154 { NodeHI++; return *this; }
THashIter NodeHI
Definition: network.h:1146
template<class TNodeData, class TEdgeData>
bool TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::operator< ( const TNodeI NodeI) const
inline

Definition at line 1155 of file network.h.

1155 { return NodeHI < NodeI.NodeHI; }
THashIter NodeHI
Definition: network.h:1146
template<class TNodeData, class TEdgeData>
TNodeI& TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::operator= ( const TNodeI NodeI)
inline

Definition at line 1152 of file network.h.

1152 { NodeHI = NodeI.NodeHI; Net=NodeI.Net; return *this; }
THashIter NodeHI
Definition: network.h:1146
TNodeEdgeNet * Net
Definition: network.h:1147
template<class TNodeData, class TEdgeData>
bool TNodeEdgeNet< TNodeData, TEdgeData >::TNodeI::operator== ( const TNodeI NodeI) const
inline

Definition at line 1156 of file network.h.

1156 { return NodeHI == NodeI.NodeHI; }
THashIter NodeHI
Definition: network.h:1146

Friends And Related Function Documentation

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

Definition at line 1215 of file network.h.

Member Data Documentation

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

Definition at line 1147 of file network.h.

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

Definition at line 1146 of file network.h.


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