SNAP Library , Developer Reference  2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TNEGraph::TNodeI Class Reference

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

#include <graph.h>

Collaboration diagram for TNEGraph::TNodeI:

List of all members.

Public Member Functions

 TNodeI ()
 TNodeI (const THashIter &NodeHIter, const TNEGraph *GraphPt)
 TNodeI (const TNodeI &NodeI)
TNodeIoperator= (const TNodeI &NodeI)
TNodeIoperator++ (int)
 Increment iterator.
bool operator< (const TNodeI &NodeI) const
bool operator== (const TNodeI &NodeI) const
int GetId () const
 Returns ID of the current node.
int GetDeg () const
 Returns degree of the current node, the sum of in-degree and out-degree.
int GetInDeg () const
 Returns in-degree of the current node.
int GetOutDeg () const
 Returns out-degree of the current node.
int GetInNId (const int &EdgeN) const
 Returns ID of EdgeN-th in-node (the node pointing to the current node).
int GetOutNId (const int &EdgeN) const
 Returns ID of EdgeN-th out-node (the node the current node points to).
int GetNbrNId (const int &EdgeN) const
 Returns ID of EdgeN-th neighboring node.
bool IsInNId (const int &NId) const
 Tests whether node with ID NId points to the current node.
bool IsOutNId (const int &NId) const
 Tests whether the current node points to node with ID NId.
bool IsNbrNId (const int &NId) const
 Tests whether node with ID NId is a neighbor of the current node.
int GetInEId (const int &EdgeN) const
 Returns ID of EdgeN-th in-edge.
int GetOutEId (const int &EdgeN) const
 Returns ID of EdgeN-th out-edge.
int GetNbrEId (const int &EdgeN) const
 Returns ID of EdgeN-th in or out-edge.
bool IsInEId (const int &EId) const
 Tests whether the edge with ID EId is an in-edge of current node.
bool IsOutEId (const int &EId) const
 Tests whether the edge with ID EId is an out-edge of current node.
bool IsNbrEId (const int &EId) const
 Tests whether the edge with ID EId is an in or out-edge of current node.

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


Member Typedef Documentation

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

Definition at line 598 of file graph.h.


Constructor & Destructor Documentation

Definition at line 602 of file graph.h.

: NodeHI(), Graph(NULL) { }
TNEGraph::TNodeI::TNodeI ( const THashIter NodeHIter,
const TNEGraph GraphPt 
) [inline]

Definition at line 603 of file graph.h.

: NodeHI(NodeHIter), Graph(GraphPt) { }
TNEGraph::TNodeI::TNodeI ( const TNodeI NodeI) [inline]

Definition at line 604 of file graph.h.

: NodeHI(NodeI.NodeHI), Graph(NodeI.Graph) { }

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

References NodeHI.

{ return NodeHI.GetDat().GetDeg(); }
int TNEGraph::TNodeI::GetId ( ) const [inline]

Returns ID of the current node.

Definition at line 611 of file graph.h.

References NodeHI.

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

{ return NodeHI.GetDat().GetId(); }

Here is the caller graph for this function:

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

Returns in-degree of the current node.

Definition at line 615 of file graph.h.

References NodeHI.

{ return NodeHI.GetDat().GetInDeg(); }
int TNEGraph::TNodeI::GetInEId ( const int &  EdgeN) const [inline]

Returns ID of EdgeN-th in-edge.

Definition at line 639 of file graph.h.

References NodeHI.

{ return NodeHI.GetDat().GetInEId(EdgeN); }
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 621 of file graph.h.

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

{ return Graph->GetEdge(NodeHI.GetDat().GetInEId(EdgeN)).GetSrcNId(); }

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

References NodeHI.

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

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

                                          { const TEdge& E = Graph->GetEdge(NodeHI.GetDat().GetNbrEId(EdgeN));
      return GetId()==E.GetSrcNId() ? E.GetDstNId():E.GetSrcNId(); }

Here is the call graph for this function:

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

Returns out-degree of the current node.

Definition at line 617 of file graph.h.

References NodeHI.

{ return NodeHI.GetDat().GetOutDeg(); }
int TNEGraph::TNodeI::GetOutEId ( const int &  EdgeN) const [inline]

Returns ID of EdgeN-th out-edge.

Definition at line 641 of file graph.h.

References NodeHI.

{ return NodeHI.GetDat().GetOutEId(EdgeN); }
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 625 of file graph.h.

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

{ return Graph->GetEdge(NodeHI.GetDat().GetOutEId(EdgeN)).GetDstNId(); }

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

References NodeHI.

Referenced by IsNbrEId().

{ return NodeHI.GetDat().IsInEId(EId); }

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

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

Referenced by IsNbrNId().

                                                 {
  const TNode& Node = NodeHI.GetDat();
  for (int edge = 0; edge < Node.GetInDeg(); edge++) {
    if (NId == Graph->GetEdge(Node.GetInEId(edge)).GetSrcNId())
      return true;
  }
  return false;
}

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

References IsInEId(), and IsOutEId().

{ return IsInEId(EId) || IsOutEId(EId); }

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

References IsInNId(), and IsOutNId().

{ return IsOutNId(NId) || IsInNId(NId); }

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

References NodeHI.

Referenced by IsNbrEId().

{ return NodeHI.GetDat().IsOutEId(EId); }

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

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

Referenced by IsNbrNId().

                                                  {
  const TNode& Node = NodeHI.GetDat();
  for (int edge = 0; edge < Node.GetOutDeg(); edge++) {
    if (NId == Graph->GetEdge(Node.GetOutEId(edge)).GetDstNId())
      return true;
  }
  return false;
}

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

References NodeHI.

{ NodeHI++; return *this; }
bool TNEGraph::TNodeI::operator< ( const TNodeI NodeI) const [inline]

Definition at line 608 of file graph.h.

References NodeHI.

{ return NodeHI < NodeI.NodeHI; }
TNodeI& TNEGraph::TNodeI::operator= ( const TNodeI NodeI) [inline]

Definition at line 605 of file graph.h.

References Graph, and NodeHI.

{ NodeHI = NodeI.NodeHI; Graph=NodeI.Graph; return *this; }
bool TNEGraph::TNodeI::operator== ( const TNodeI NodeI) const [inline]

Definition at line 609 of file graph.h.

References NodeHI.

{ return NodeHI == NodeI.NodeHI; }

Friends And Related Function Documentation

friend class TNEGraph [friend]

Definition at line 650 of file graph.h.


Member Data Documentation

Definition at line 600 of file graph.h.

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


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