SNAP Library 2.3, Developer Reference  2014-06-16 11:58:46
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...
 
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 598 of file graph.h.

Member Typedef Documentation

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

Definition at line 600 of file graph.h.

Constructor & Destructor Documentation

TNEGraph::TNodeI::TNodeI ( )
inline

Definition at line 604 of file graph.h.

604 : NodeHI(), Graph(NULL) { }
THashIter NodeHI
Definition: graph.h:601
const TNEGraph * Graph
Definition: graph.h:602
TNEGraph::TNodeI::TNodeI ( const THashIter NodeHIter,
const TNEGraph GraphPt 
)
inline

Definition at line 605 of file graph.h.

605 : NodeHI(NodeHIter), Graph(GraphPt) { }
THashIter NodeHI
Definition: graph.h:601
const TNEGraph * Graph
Definition: graph.h:602
TNEGraph::TNodeI::TNodeI ( const TNodeI NodeI)
inline

Definition at line 606 of file graph.h.

606 : NodeHI(NodeI.NodeHI), Graph(NodeI.Graph) { }
THashIter NodeHI
Definition: graph.h:601
const TNEGraph * Graph
Definition: graph.h:602

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

References NodeHI.

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

Returns ID of the current node.

Definition at line 613 of file graph.h.

References NodeHI.

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

613 { return NodeHI.GetDat().GetId(); }
THashIter NodeHI
Definition: graph.h:601

Here is the caller graph for this function:

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

Returns in-degree of the current node.

Definition at line 617 of file graph.h.

References NodeHI.

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

Returns ID of EdgeN-th in-edge.

Definition at line 641 of file graph.h.

References NodeHI.

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

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

623 { return Graph->GetEdge(NodeHI.GetDat().GetInEId(EdgeN)).GetSrcNId(); }
THashIter NodeHI
Definition: graph.h:601
TEdge & GetEdge(const int &EId)
Definition: graph.h:681
const TNEGraph * Graph
Definition: graph.h:602

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

References NodeHI.

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

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

631  { const TEdge& E = Graph->GetEdge(NodeHI.GetDat().GetNbrEId(EdgeN));
632  return GetId()==E.GetSrcNId() ? E.GetDstNId():E.GetSrcNId(); }
THashIter NodeHI
Definition: graph.h:601
TEdge & GetEdge(const int &EId)
Definition: graph.h:681
const TNEGraph * Graph
Definition: graph.h:602
int GetId() const
Returns ID of the current node.
Definition: graph.h:613

Here is the call graph for this function:

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

Returns out-degree of the current node.

Definition at line 619 of file graph.h.

References NodeHI.

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

Returns ID of EdgeN-th out-edge.

Definition at line 643 of file graph.h.

References NodeHI.

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

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

627 { return Graph->GetEdge(NodeHI.GetDat().GetOutEId(EdgeN)).GetDstNId(); }
THashIter NodeHI
Definition: graph.h:601
TEdge & GetEdge(const int &EId)
Definition: graph.h:681
const TNEGraph * Graph
Definition: graph.h:602

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

References NodeHI.

Referenced by IsNbrEId().

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

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:601
TEdge & GetEdge(const int &EId)
Definition: graph.h:681
const TNEGraph * Graph
Definition: graph.h:602

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

References IsInEId(), and IsOutEId().

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

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

References IsInNId(), and IsOutNId().

638 { 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 649 of file graph.h.

References NodeHI.

Referenced by IsNbrEId().

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

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:601
TEdge & GetEdge(const int &EId)
Definition: graph.h:681
const TNEGraph * Graph
Definition: graph.h:602

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

References NodeHI.

609 { NodeHI++; return *this; }
THashIter NodeHI
Definition: graph.h:601
bool TNEGraph::TNodeI::operator< ( const TNodeI NodeI) const
inline

Definition at line 610 of file graph.h.

References NodeHI.

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

Definition at line 607 of file graph.h.

References Graph, and NodeHI.

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

Definition at line 611 of file graph.h.

References NodeHI.

611 { return NodeHI == NodeI.NodeHI; }
THashIter NodeHI
Definition: graph.h:601

Friends And Related Function Documentation

friend class TNEGraph
friend

Definition at line 652 of file graph.h.

Member Data Documentation

const TNEGraph* TNEGraph::TNodeI::Graph
private

Definition at line 602 of file graph.h.

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


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