SNAP Library 2.4, User 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
TNodeNet< TNodeData >::TEdgeI Class Reference

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

#include <network.h>

Public Member Functions

 TEdgeI ()
 
 TEdgeI (const TNodeI &NodeI, const TNodeI &EndNodeI, const int &EdgeN=0)
 
 TEdgeI (const TEdgeI &EdgeI)
 
TEdgeIoperator= (const TEdgeI &EdgeI)
 
TEdgeIoperator++ (int)
 Increment iterator. More...
 
bool operator< (const TEdgeI &EdgeI) const
 
bool operator== (const TEdgeI &EdgeI) const
 
int GetId () const
 Gets edge ID. Always returns -1 since only edges in multigraphs have explicit IDs. More...
 
int GetSrcNId () const
 Gets the source node of an edge. More...
 
int GetDstNId () const
 Gets the destination node of an edge. More...
 
const TNodeData & GetSrcNDat () const
 
TNodeData & GetDstNDat ()
 

Private Attributes

TNodeI CurNode
 
TNodeI EndNode
 
int CurEdge
 

Friends

class TNodeNet< TNodeData >
 

Detailed Description

template<class TNodeData>
class TNodeNet< TNodeData >::TEdgeI

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

Definition at line 104 of file network.h.

Constructor & Destructor Documentation

template<class TNodeData>
TNodeNet< TNodeData >::TEdgeI::TEdgeI ( )
inline

Definition at line 109 of file network.h.

109 : CurNode(), EndNode(), CurEdge(0) { }
TNodeI EndNode
Definition: network.h:106
TNodeI CurNode
Definition: network.h:106
template<class TNodeData>
TNodeNet< TNodeData >::TEdgeI::TEdgeI ( const TNodeI NodeI,
const TNodeI EndNodeI,
const int &  EdgeN = 0 
)
inline

Definition at line 110 of file network.h.

110 : CurNode(NodeI), EndNode(EndNodeI), CurEdge(EdgeN) { }
TNodeI EndNode
Definition: network.h:106
TNodeI CurNode
Definition: network.h:106
template<class TNodeData>
TNodeNet< TNodeData >::TEdgeI::TEdgeI ( const TEdgeI EdgeI)
inline

Definition at line 111 of file network.h.

111 : CurNode(EdgeI.CurNode), EndNode(EdgeI.EndNode), CurEdge(EdgeI.CurEdge) { }
TNodeI EndNode
Definition: network.h:106
TNodeI CurNode
Definition: network.h:106

Member Function Documentation

template<class TNodeData>
TNodeData& TNodeNet< TNodeData >::TEdgeI::GetDstNDat ( )
inline

Definition at line 125 of file network.h.

125 { return CurNode.GetOutNDat(CurEdge); }
const TNodeData & GetOutNDat(const int &NodeN) const
Definition: network.h:96
TNodeI CurNode
Definition: network.h:106
template<class TNodeData>
int TNodeNet< TNodeData >::TEdgeI::GetDstNId ( ) const
inline

Gets the destination node of an edge.

Definition at line 123 of file network.h.

123 { return CurNode.GetOutNId(CurEdge); }
TNodeI CurNode
Definition: network.h:106
int GetOutNId(const int &NodeN) const
Returns ID of NodeN-th out-node (the node the current node points to).
Definition: network.h:79
template<class TNodeData>
int TNodeNet< TNodeData >::TEdgeI::GetId ( ) const
inline

Gets edge ID. Always returns -1 since only edges in multigraphs have explicit IDs.

Definition at line 119 of file network.h.

119 { return -1; }
template<class TNodeData>
const TNodeData& TNodeNet< TNodeData >::TEdgeI::GetSrcNDat ( ) const
inline

Definition at line 124 of file network.h.

124 { return CurNode.GetDat(); }
const TNodeData & GetDat() const
Definition: network.h:92
TNodeI CurNode
Definition: network.h:106
template<class TNodeData>
int TNodeNet< TNodeData >::TEdgeI::GetSrcNId ( ) const
inline

Gets the source node of an edge.

Definition at line 121 of file network.h.

121 { return CurNode.GetId(); }
int GetId() const
Returns ID of the current node.
Definition: network.h:65
TNodeI CurNode
Definition: network.h:106
template<class TNodeData>
TEdgeI& TNodeNet< TNodeData >::TEdgeI::operator++ ( int  )
inline

Increment iterator.

Definition at line 114 of file network.h.

114  { CurEdge++; if (CurEdge >= CurNode.GetOutDeg()) { CurEdge=0; CurNode++;
115  while (CurNode < EndNode && CurNode.GetOutDeg()==0) { CurNode++; } } return *this; }
TNodeI EndNode
Definition: network.h:106
TNodeI CurNode
Definition: network.h:106
int GetOutDeg() const
Returns out-degree of the current node.
Definition: network.h:71
template<class TNodeData>
bool TNodeNet< TNodeData >::TEdgeI::operator< ( const TEdgeI EdgeI) const
inline

Definition at line 116 of file network.h.

116 { return CurNode<EdgeI.CurNode || (CurNode==EdgeI.CurNode && CurEdge<EdgeI.CurEdge); }
TNodeI CurNode
Definition: network.h:106
template<class TNodeData>
TEdgeI& TNodeNet< TNodeData >::TEdgeI::operator= ( const TEdgeI EdgeI)
inline

Definition at line 112 of file network.h.

112 { if (this!=&EdgeI) { CurNode=EdgeI.CurNode; EndNode=EdgeI.EndNode; CurEdge=EdgeI.CurEdge; } return *this; }
TNodeI EndNode
Definition: network.h:106
TNodeI CurNode
Definition: network.h:106
template<class TNodeData>
bool TNodeNet< TNodeData >::TEdgeI::operator== ( const TEdgeI EdgeI) const
inline

Definition at line 117 of file network.h.

117 { return CurNode == EdgeI.CurNode && CurEdge == EdgeI.CurEdge; }
TNodeI CurNode
Definition: network.h:106

Friends And Related Function Documentation

template<class TNodeData>
friend class TNodeNet< TNodeData >
friend

Definition at line 126 of file network.h.

Member Data Documentation

template<class TNodeData>
int TNodeNet< TNodeData >::TEdgeI::CurEdge
private

Definition at line 107 of file network.h.

template<class TNodeData>
TNodeI TNodeNet< TNodeData >::TEdgeI::CurNode
private

Definition at line 106 of file network.h.

template<class TNodeData>
TNodeI TNodeNet< TNodeData >::TEdgeI::EndNode
private

Definition at line 106 of file network.h.


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