SNAP Library 4.0, Developer Reference  2017-07-27 13:18:06
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
TNEGraph::TNodeI Class Reference

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

#include <graph.h>

Collaboration diagram for TNEGraph::TNodeI:

Public Member Functions

 TNodeI ()
 
 TNodeI (const THashIter &NodeHIter, const TNEGraph *GraphPt)
 
 TNodeI (const TNodeI &NodeI)
 
TNodeIoperator= (const TNodeI &NodeI)
 
TNodeIoperator++ (int)
 Increment iterator. More...
 
TNodeIoperator-- (int)
 Decrement 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...
 
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...
 

Private Types

typedef THash< TInt, TNode >::TIter THashIter
 

Private Attributes

THashIter NodeHI
 
const TNEGraphGraph
 

Friends

class TNEGraph
 

Detailed Description

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

Definition at line 698 of file graph.h.

Member Typedef Documentation

typedef THash<TInt, TNode>::TIter TNEGraph::TNodeI::THashIter
private

Definition at line 700 of file graph.h.

Constructor & Destructor Documentation

TNEGraph::TNodeI::TNodeI ( )
inline

Definition at line 704 of file graph.h.

704 : NodeHI(), Graph(NULL) { }
THashIter NodeHI
Definition: graph.h:701
const TNEGraph * Graph
Definition: graph.h:702
TNEGraph::TNodeI::TNodeI ( const THashIter NodeHIter,
const TNEGraph GraphPt 
)
inline

Definition at line 705 of file graph.h.

705 : NodeHI(NodeHIter), Graph(GraphPt) { }
THashIter NodeHI
Definition: graph.h:701
const TNEGraph * Graph
Definition: graph.h:702
TNEGraph::TNodeI::TNodeI ( const TNodeI NodeI)
inline

Definition at line 706 of file graph.h.

706 : NodeHI(NodeI.NodeHI), Graph(NodeI.Graph) { }
THashIter NodeHI
Definition: graph.h:701
const TNEGraph * Graph
Definition: graph.h:702

Member Function Documentation

int TNEGraph::TNodeI::GetDeg ( ) const
inline

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

Definition at line 718 of file graph.h.

References NodeHI.

718 { return NodeHI.GetDat().GetDeg(); }
THashIter NodeHI
Definition: graph.h:701
int TNEGraph::TNodeI::GetId ( ) const
inline

Returns ID of the current node.

Definition at line 716 of file graph.h.

References NodeHI.

Referenced by TNEGraph::AddNode(), and GetNbrNId().

716 { return NodeHI.GetDat().GetId(); }
THashIter NodeHI
Definition: graph.h:701

Here is the caller graph for this function:

int TNEGraph::TNodeI::GetInDeg ( ) const
inline

Returns in-degree of the current node.

Definition at line 720 of file graph.h.

References NodeHI.

720 { return NodeHI.GetDat().GetInDeg(); }
THashIter NodeHI
Definition: graph.h:701
int TNEGraph::TNodeI::GetInEId ( const int &  EdgeN) const
inline

Returns ID of EdgeN-th in-edge.

Definition at line 744 of file graph.h.

References NodeHI.

744 { return NodeHI.GetDat().GetInEId(EdgeN); }
THashIter NodeHI
Definition: graph.h:701
int TNEGraph::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 726 of file graph.h.

References TNEGraph::GetEdge(), Graph, and NodeHI.

726 { return Graph->GetEdge(NodeHI.GetDat().GetInEId(EdgeN)).GetSrcNId(); }
THashIter NodeHI
Definition: graph.h:701
TEdge & GetEdge(const int &EId)
Definition: graph.h:784
const TNEGraph * Graph
Definition: graph.h:702

Here is the call graph for this function:

int TNEGraph::TNodeI::GetNbrEId ( const int &  EdgeN) const
inline

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

Definition at line 748 of file graph.h.

References NodeHI.

748 { return NodeHI.GetDat().GetNbrEId(EdgeN); }
THashIter NodeHI
Definition: graph.h:701
int TNEGraph::TNodeI::GetNbrNId ( const int &  EdgeN) const
inline

Returns ID of EdgeN-th neighboring node.

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

Definition at line 734 of file graph.h.

References TNEGraph::TEdge::GetDstNId(), TNEGraph::GetEdge(), GetId(), TNEGraph::TEdge::GetSrcNId(), Graph, and NodeHI.

734  { const TEdge& E = Graph->GetEdge(NodeHI.GetDat().GetNbrEId(EdgeN));
735  return GetId()==E.GetSrcNId() ? E.GetDstNId():E.GetSrcNId(); }
THashIter NodeHI
Definition: graph.h:701
TEdge & GetEdge(const int &EId)
Definition: graph.h:784
const TNEGraph * Graph
Definition: graph.h:702
int GetId() const
Returns ID of the current node.
Definition: graph.h:716

Here is the call graph for this function:

int TNEGraph::TNodeI::GetOutDeg ( ) const
inline

Returns out-degree of the current node.

Definition at line 722 of file graph.h.

References NodeHI.

722 { return NodeHI.GetDat().GetOutDeg(); }
THashIter NodeHI
Definition: graph.h:701
int TNEGraph::TNodeI::GetOutEId ( const int &  EdgeN) const
inline

Returns ID of EdgeN-th out-edge.

Definition at line 746 of file graph.h.

References NodeHI.

746 { return NodeHI.GetDat().GetOutEId(EdgeN); }
THashIter NodeHI
Definition: graph.h:701
int TNEGraph::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 730 of file graph.h.

References TNEGraph::GetEdge(), Graph, and NodeHI.

730 { return Graph->GetEdge(NodeHI.GetDat().GetOutEId(EdgeN)).GetDstNId(); }
THashIter NodeHI
Definition: graph.h:701
TEdge & GetEdge(const int &EId)
Definition: graph.h:784
const TNEGraph * Graph
Definition: graph.h:702

Here is the call graph for this function:

bool TNEGraph::TNodeI::IsInEId ( const int &  EId) const
inline

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

Definition at line 750 of file graph.h.

References NodeHI.

Referenced by IsNbrEId().

750 { return NodeHI.GetDat().IsInEId(EId); }
THashIter NodeHI
Definition: graph.h:701

Here is the caller graph for this function:

bool TNEGraph::TNodeI::IsInNId ( const int &  NId) const

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

Definition at line 468 of file graph.cpp.

References edge, TNEGraph::GetEdge(), TNEGraph::TNode::GetInDeg(), TNEGraph::TNode::GetInEId(), Graph, and NodeHI.

Referenced by IsNbrNId().

468  {
469  const TNode& Node = NodeHI.GetDat();
470  for (int edge = 0; edge < Node.GetInDeg(); edge++) {
471  if (NId == Graph->GetEdge(Node.GetInEId(edge)).GetSrcNId())
472  return true;
473  }
474  return false;
475 }
THashIter NodeHI
Definition: graph.h:701
TEdge & GetEdge(const int &EId)
Definition: graph.h:784
const TNEGraph * Graph
Definition: graph.h:702

Here is the call graph for this function:

Here is the caller graph for this function:

bool TNEGraph::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 754 of file graph.h.

References IsInEId(), and IsOutEId().

754 { return IsInEId(EId) || IsOutEId(EId); }
bool IsOutEId(const int &EId) const
Tests whether the edge with ID EId is an out-edge of current node.
Definition: graph.h:752
bool IsInEId(const int &EId) const
Tests whether the edge with ID EId is an in-edge of current node.
Definition: graph.h:750

Here is the call graph for this function:

bool TNEGraph::TNodeI::IsNbrNId ( const int &  NId) const
inline

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

Definition at line 741 of file graph.h.

References IsInNId(), and IsOutNId().

741 { return IsOutNId(NId) || IsInNId(NId); }
bool IsInNId(const int &NId) const
Tests whether node with ID NId points to the current node.
Definition: graph.cpp:468
bool IsOutNId(const int &NId) const
Tests whether the current node points to node with ID NId.
Definition: graph.cpp:477

Here is the call graph for this function:

bool TNEGraph::TNodeI::IsOutEId ( const int &  EId) const
inline

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

Definition at line 752 of file graph.h.

References NodeHI.

Referenced by IsNbrEId().

752 { return NodeHI.GetDat().IsOutEId(EId); }
THashIter NodeHI
Definition: graph.h:701

Here is the caller graph for this function:

bool TNEGraph::TNodeI::IsOutNId ( const int &  NId) const

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

Definition at line 477 of file graph.cpp.

References edge, TNEGraph::TNode::GetOutDeg(), and TNEGraph::TNode::GetOutEId().

Referenced by IsNbrNId().

477  {
478  const TNode& Node = NodeHI.GetDat();
479  for (int edge = 0; edge < Node.GetOutDeg(); edge++) {
480  if (NId == Graph->GetEdge(Node.GetOutEId(edge)).GetDstNId())
481  return true;
482  }
483  return false;
484 }
THashIter NodeHI
Definition: graph.h:701
TEdge & GetEdge(const int &EId)
Definition: graph.h:784
const TNEGraph * Graph
Definition: graph.h:702

Here is the call graph for this function:

Here is the caller graph for this function:

TNodeI& TNEGraph::TNodeI::operator++ ( int  )
inline

Increment iterator.

Definition at line 709 of file graph.h.

References NodeHI.

709 { NodeHI++; return *this; }
THashIter NodeHI
Definition: graph.h:701
TNodeI& TNEGraph::TNodeI::operator-- ( int  )
inline

Decrement iterator.

Definition at line 711 of file graph.h.

References NodeHI.

711 { NodeHI--; return *this; }
THashIter NodeHI
Definition: graph.h:701
bool TNEGraph::TNodeI::operator< ( const TNodeI NodeI) const
inline

Definition at line 713 of file graph.h.

References NodeHI.

713 { return NodeHI < NodeI.NodeHI; }
THashIter NodeHI
Definition: graph.h:701
TNodeI& TNEGraph::TNodeI::operator= ( const TNodeI NodeI)
inline

Definition at line 707 of file graph.h.

References Graph, and NodeHI.

707 { NodeHI = NodeI.NodeHI; Graph=NodeI.Graph; return *this; }
THashIter NodeHI
Definition: graph.h:701
const TNEGraph * Graph
Definition: graph.h:702
bool TNEGraph::TNodeI::operator== ( const TNodeI NodeI) const
inline

Definition at line 714 of file graph.h.

References NodeHI.

714 { return NodeHI == NodeI.NodeHI; }
THashIter NodeHI
Definition: graph.h:701

Friends And Related Function Documentation

friend class TNEGraph
friend

Definition at line 755 of file graph.h.

Member Data Documentation

const TNEGraph* TNEGraph::TNodeI::Graph
private

Definition at line 702 of file graph.h.

Referenced by GetInNId(), GetNbrNId(), GetOutNId(), IsInNId(), and operator=().


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