SNAP Library 3.0, User Reference  2016-07-20 17:56:49
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>

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 626 of file graph.h.

Member Typedef Documentation

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

Definition at line 628 of file graph.h.

Constructor & Destructor Documentation

TNEGraph::TNodeI::TNodeI ( )
inline

Definition at line 632 of file graph.h.

632 : NodeHI(), Graph(NULL) { }
THashIter NodeHI
Definition: graph.h:629
const TNEGraph * Graph
Definition: graph.h:630
TNEGraph::TNodeI::TNodeI ( const THashIter NodeHIter,
const TNEGraph GraphPt 
)
inline

Definition at line 633 of file graph.h.

633 : NodeHI(NodeHIter), Graph(GraphPt) { }
THashIter NodeHI
Definition: graph.h:629
const TNEGraph * Graph
Definition: graph.h:630
TNEGraph::TNodeI::TNodeI ( const TNodeI NodeI)
inline

Definition at line 634 of file graph.h.

634 : NodeHI(NodeI.NodeHI), Graph(NodeI.Graph) { }
THashIter NodeHI
Definition: graph.h:629
const TNEGraph * Graph
Definition: graph.h:630

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 646 of file graph.h.

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

Returns ID of the current node.

Definition at line 644 of file graph.h.

644 { return NodeHI.GetDat().GetId(); }
THashIter NodeHI
Definition: graph.h:629
int TNEGraph::TNodeI::GetInDeg ( ) const
inline

Returns in-degree of the current node.

Definition at line 648 of file graph.h.

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

Returns ID of EdgeN-th in-edge.

Definition at line 672 of file graph.h.

672 { return NodeHI.GetDat().GetInEId(EdgeN); }
THashIter NodeHI
Definition: graph.h:629
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 654 of file graph.h.

654 { return Graph->GetEdge(NodeHI.GetDat().GetInEId(EdgeN)).GetSrcNId(); }
THashIter NodeHI
Definition: graph.h:629
TEdge & GetEdge(const int &EId)
Definition: graph.h:712
const TNEGraph * Graph
Definition: graph.h:630
int TNEGraph::TNodeI::GetNbrEId ( const int &  EdgeN) const
inline

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

Definition at line 676 of file graph.h.

676 { return NodeHI.GetDat().GetNbrEId(EdgeN); }
THashIter NodeHI
Definition: graph.h:629
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 662 of file graph.h.

662  { const TEdge& E = Graph->GetEdge(NodeHI.GetDat().GetNbrEId(EdgeN));
663  return GetId()==E.GetSrcNId() ? E.GetDstNId():E.GetSrcNId(); }
THashIter NodeHI
Definition: graph.h:629
TEdge & GetEdge(const int &EId)
Definition: graph.h:712
const TNEGraph * Graph
Definition: graph.h:630
int GetId() const
Returns ID of the current node.
Definition: graph.h:644
int TNEGraph::TNodeI::GetOutDeg ( ) const
inline

Returns out-degree of the current node.

Definition at line 650 of file graph.h.

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

Returns ID of EdgeN-th out-edge.

Definition at line 674 of file graph.h.

674 { return NodeHI.GetDat().GetOutEId(EdgeN); }
THashIter NodeHI
Definition: graph.h:629
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 658 of file graph.h.

658 { return Graph->GetEdge(NodeHI.GetDat().GetOutEId(EdgeN)).GetDstNId(); }
THashIter NodeHI
Definition: graph.h:629
TEdge & GetEdge(const int &EId)
Definition: graph.h:712
const TNEGraph * Graph
Definition: graph.h:630
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 678 of file graph.h.

678 { return NodeHI.GetDat().IsInEId(EId); }
THashIter NodeHI
Definition: graph.h:629
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.

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:629
TEdge & GetEdge(const int &EId)
Definition: graph.h:712
const TNEGraph * Graph
Definition: graph.h:630
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 682 of file graph.h.

682 { 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:680
bool IsInEId(const int &EId) const
Tests whether the edge with ID EId is an in-edge of current node.
Definition: graph.h:678
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 669 of file graph.h.

669 { 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
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 680 of file graph.h.

680 { return NodeHI.GetDat().IsOutEId(EId); }
THashIter NodeHI
Definition: graph.h:629
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.

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:629
TEdge & GetEdge(const int &EId)
Definition: graph.h:712
const TNEGraph * Graph
Definition: graph.h:630
TNodeI& TNEGraph::TNodeI::operator++ ( int  )
inline

Increment iterator.

Definition at line 637 of file graph.h.

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

Decrement iterator.

Definition at line 639 of file graph.h.

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

Definition at line 641 of file graph.h.

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

Definition at line 635 of file graph.h.

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

Definition at line 642 of file graph.h.

642 { return NodeHI == NodeI.NodeHI; }
THashIter NodeHI
Definition: graph.h:629

Friends And Related Function Documentation

friend class TNEGraph
friend

Definition at line 683 of file graph.h.

Member Data Documentation

const TNEGraph* TNEGraph::TNodeI::Graph
private

Definition at line 630 of file graph.h.

THashIter TNEGraph::TNodeI::NodeHI
private

Definition at line 629 of file graph.h.


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