SNAP Library 2.1, User Reference  2013-09-25 10:47:25
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
TNEANet::TNodeI Class Reference

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

#include <network.h>

List of all members.

Public Member Functions

 TNodeI ()
 TNodeI (const THashIter &NodeHIter, const TNEANet *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.
void GetAttrNames (TStrV &Names) const
 Gets vector of attribute names.
void GetAttrVal (TStrV &Val) const
 Gets vector of attribute values.
void GetIntAttrNames (TStrV &Names) const
 Gets vector of int attribute names.
void GetIntAttrVal (TIntV &Val) const
 Gets vector of int attribute values.
void GetStrAttrNames (TStrV &Names) const
 Gets vector of str attribute names.
void GetStrAttrVal (TStrV &Val) const
 Gets vector of str attribute values.
void GetFltAttrNames (TStrV &Names) const
 Gets vector of flt attribute names.
void GetFltAttrVal (TFltV &Val) const
 Gets vector of flt attribute values.

Private Types

typedef THash< TInt, TNode >::TIter THashIter

Private Attributes

THashIter NodeHI
const TNEANetGraph

Friends

class TNEANet

Detailed Description

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

Definition at line 1616 of file network.h.


Member Typedef Documentation

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

Definition at line 1618 of file network.h.


Constructor & Destructor Documentation

Definition at line 1622 of file network.h.

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

Definition at line 1623 of file network.h.

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

Definition at line 1624 of file network.h.

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

Member Function Documentation

void TNEANet::TNodeI::GetAttrNames ( TStrV Names) const [inline]

Gets vector of attribute names.

Definition at line 1669 of file network.h.

{ Graph->AttrNameNI(GetId(), Names); }
void TNEANet::TNodeI::GetAttrVal ( TStrV Val) const [inline]

Gets vector of attribute values.

Definition at line 1671 of file network.h.

{ Graph->AttrValueNI(GetId(), Val); }
int TNEANet::TNodeI::GetDeg ( ) const [inline]

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

Definition at line 1633 of file network.h.

{ return NodeHI.GetDat().GetDeg(); }
void TNEANet::TNodeI::GetFltAttrNames ( TStrV Names) const [inline]

Gets vector of flt attribute names.

Definition at line 1681 of file network.h.

{ Graph->FltAttrNameNI(GetId(), Names); }
void TNEANet::TNodeI::GetFltAttrVal ( TFltV Val) const [inline]

Gets vector of flt attribute values.

Definition at line 1683 of file network.h.

{ Graph->FltAttrValueNI(GetId(), Val); }
int TNEANet::TNodeI::GetId ( ) const [inline]

Returns ID of the current node.

Definition at line 1631 of file network.h.

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

Returns in-degree of the current node.

Definition at line 1635 of file network.h.

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

Returns ID of EdgeN-th in-edge.

Definition at line 1657 of file network.h.

{ return NodeHI.GetDat().GetInEId(EdgeN); }
int TNEANet::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 1641 of file network.h.

{ return Graph->GetEdge(NodeHI.GetDat().GetInEId(EdgeN)).GetSrcNId(); }
void TNEANet::TNodeI::GetIntAttrNames ( TStrV Names) const [inline]

Gets vector of int attribute names.

Definition at line 1673 of file network.h.

{ Graph->IntAttrNameNI(GetId(), Names); }
void TNEANet::TNodeI::GetIntAttrVal ( TIntV Val) const [inline]

Gets vector of int attribute values.

Definition at line 1675 of file network.h.

{ Graph->IntAttrValueNI(GetId(), Val); }
int TNEANet::TNodeI::GetNbrEId ( const int &  EdgeN) const [inline]

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

Definition at line 1661 of file network.h.

{ return NodeHI.GetDat().GetNbrEId(EdgeN); }
int TNEANet::TNodeI::GetNbrNId ( const int &  EdgeN) const [inline]

Returns ID of EdgeN-th neighboring node.

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

Definition at line 1649 of file network.h.

{ const TEdge& E = Graph->GetEdge(NodeHI.GetDat().GetNbrEId(EdgeN)); return GetId()==E.GetSrcNId() ? E.GetDstNId():E.GetSrcNId(); }
int TNEANet::TNodeI::GetOutDeg ( ) const [inline]

Returns out-degree of the current node.

Definition at line 1637 of file network.h.

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

Returns ID of EdgeN-th out-edge.

Definition at line 1659 of file network.h.

{ return NodeHI.GetDat().GetOutEId(EdgeN); }
int TNEANet::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 1645 of file network.h.

{ return Graph->GetEdge(NodeHI.GetDat().GetOutEId(EdgeN)).GetDstNId(); }
void TNEANet::TNodeI::GetStrAttrNames ( TStrV Names) const [inline]

Gets vector of str attribute names.

Definition at line 1677 of file network.h.

{ Graph->StrAttrNameNI(GetId(), Names); }
void TNEANet::TNodeI::GetStrAttrVal ( TStrV Val) const [inline]

Gets vector of str attribute values.

Definition at line 1679 of file network.h.

{ Graph->StrAttrValueNI(GetId(), Val); }
bool TNEANet::TNodeI::IsInEId ( const int &  EId) const [inline]

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

Definition at line 1663 of file network.h.

{ return NodeHI.GetDat().IsInEId(EId); }
bool TNEANet::TNodeI::IsInNId ( const int &  NId) const

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

Definition at line 7 of file network.cpp.

                                                {
  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;
}
bool TNEANet::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 1667 of file network.h.

{ return IsInEId(EId) || IsOutEId(EId); }
bool TNEANet::TNodeI::IsNbrNId ( const int &  NId) const [inline]

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

Definition at line 1655 of file network.h.

{ return IsOutNId(NId) || IsInNId(NId); }
bool TNEANet::TNodeI::IsOutEId ( const int &  EId) const [inline]

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

Definition at line 1665 of file network.h.

{ return NodeHI.GetDat().IsOutEId(EId); }
bool TNEANet::TNodeI::IsOutNId ( const int &  NId) const

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

Definition at line 16 of file network.cpp.

                                                 {
  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;
}
TNodeI& TNEANet::TNodeI::operator++ ( int  ) [inline]

Increment iterator.

Definition at line 1627 of file network.h.

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

Definition at line 1628 of file network.h.

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

Definition at line 1625 of file network.h.

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

Definition at line 1629 of file network.h.

{ return NodeHI == NodeI.NodeHI; }

Friends And Related Function Documentation

friend class TNEANet [friend]

Definition at line 1684 of file network.h.


Member Data Documentation

const TNEANet* TNEANet::TNodeI::Graph [private]

Definition at line 1620 of file network.h.

Definition at line 1619 of file network.h.


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