SNAP Library 2.4, Developer Reference  2015-05-11 19:40:56
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 604 of file graph.h.

Member Typedef Documentation

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

Definition at line 606 of file graph.h.

Constructor & Destructor Documentation

TNEGraph::TNodeI::TNodeI ( )
inline

Definition at line 610 of file graph.h.

610 : NodeHI(), Graph(NULL) { }
THashIter NodeHI
Definition: graph.h:607
const TNEGraph * Graph
Definition: graph.h:608
TNEGraph::TNodeI::TNodeI ( const THashIter NodeHIter,
const TNEGraph GraphPt 
)
inline

Definition at line 611 of file graph.h.

611 : NodeHI(NodeHIter), Graph(GraphPt) { }
THashIter NodeHI
Definition: graph.h:607
const TNEGraph * Graph
Definition: graph.h:608
TNEGraph::TNodeI::TNodeI ( const TNodeI NodeI)
inline

Definition at line 612 of file graph.h.

612 : NodeHI(NodeI.NodeHI), Graph(NodeI.Graph) { }
THashIter NodeHI
Definition: graph.h:607
const TNEGraph * Graph
Definition: graph.h:608

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

References NodeHI.

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

Returns ID of the current node.

Definition at line 622 of file graph.h.

References NodeHI.

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

622 { return NodeHI.GetDat().GetId(); }
THashIter NodeHI
Definition: graph.h:607

Here is the caller graph for this function:

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

Returns in-degree of the current node.

Definition at line 626 of file graph.h.

References NodeHI.

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

Returns ID of EdgeN-th in-edge.

Definition at line 650 of file graph.h.

References NodeHI.

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

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

632 { return Graph->GetEdge(NodeHI.GetDat().GetInEId(EdgeN)).GetSrcNId(); }
THashIter NodeHI
Definition: graph.h:607
TEdge & GetEdge(const int &EId)
Definition: graph.h:690
const TNEGraph * Graph
Definition: graph.h:608

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

References NodeHI.

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

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

640  { const TEdge& E = Graph->GetEdge(NodeHI.GetDat().GetNbrEId(EdgeN));
641  return GetId()==E.GetSrcNId() ? E.GetDstNId():E.GetSrcNId(); }
THashIter NodeHI
Definition: graph.h:607
TEdge & GetEdge(const int &EId)
Definition: graph.h:690
const TNEGraph * Graph
Definition: graph.h:608
int GetId() const
Returns ID of the current node.
Definition: graph.h:622

Here is the call graph for this function:

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

Returns out-degree of the current node.

Definition at line 628 of file graph.h.

References NodeHI.

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

Returns ID of EdgeN-th out-edge.

Definition at line 652 of file graph.h.

References NodeHI.

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

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

636 { return Graph->GetEdge(NodeHI.GetDat().GetOutEId(EdgeN)).GetDstNId(); }
THashIter NodeHI
Definition: graph.h:607
TEdge & GetEdge(const int &EId)
Definition: graph.h:690
const TNEGraph * Graph
Definition: graph.h:608

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

References NodeHI.

Referenced by IsNbrEId().

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

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 418 of file graph.cpp.

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

Referenced by IsNbrNId().

418  {
419  const TNode& Node = NodeHI.GetDat();
420  for (int edge = 0; edge < Node.GetInDeg(); edge++) {
421  if (NId == Graph->GetEdge(Node.GetInEId(edge)).GetSrcNId())
422  return true;
423  }
424  return false;
425 }
THashIter NodeHI
Definition: graph.h:607
TEdge & GetEdge(const int &EId)
Definition: graph.h:690
const TNEGraph * Graph
Definition: graph.h:608

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

References IsInEId(), and IsOutEId().

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

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

References IsInNId(), and IsOutNId().

647 { 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:418
bool IsOutNId(const int &NId) const
Tests whether the current node points to node with ID NId.
Definition: graph.cpp:427

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

References NodeHI.

Referenced by IsNbrEId().

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

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 427 of file graph.cpp.

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

Referenced by IsNbrNId().

427  {
428  const TNode& Node = NodeHI.GetDat();
429  for (int edge = 0; edge < Node.GetOutDeg(); edge++) {
430  if (NId == Graph->GetEdge(Node.GetOutEId(edge)).GetDstNId())
431  return true;
432  }
433  return false;
434 }
THashIter NodeHI
Definition: graph.h:607
TEdge & GetEdge(const int &EId)
Definition: graph.h:690
const TNEGraph * Graph
Definition: graph.h:608

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

References NodeHI.

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

Decrement iterator.

Definition at line 617 of file graph.h.

References NodeHI.

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

Definition at line 619 of file graph.h.

References NodeHI.

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

Definition at line 613 of file graph.h.

References Graph, and NodeHI.

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

Definition at line 620 of file graph.h.

References NodeHI.

620 { return NodeHI == NodeI.NodeHI; }
THashIter NodeHI
Definition: graph.h:607

Friends And Related Function Documentation

friend class TNEGraph
friend

Definition at line 661 of file graph.h.

Member Data Documentation

const TNEGraph* TNEGraph::TNodeI::Graph
private

Definition at line 608 of file graph.h.

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


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