SNAP Library 3.0, User Reference  2016-07-20 17:56:49
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 107 of file network.h.

Constructor & Destructor Documentation

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

Definition at line 112 of file network.h.

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

Definition at line 113 of file network.h.

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

Definition at line 114 of file network.h.

114 : CurNode(EdgeI.CurNode), EndNode(EdgeI.EndNode), CurEdge(EdgeI.CurEdge) { }
TNodeI EndNode
Definition: network.h:109
TNodeI CurNode
Definition: network.h:109

Member Function Documentation

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

Definition at line 128 of file network.h.

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

Gets the destination node of an edge.

Definition at line 126 of file network.h.

126 { return CurNode.GetOutNId(CurEdge); }
TNodeI CurNode
Definition: network.h:109
int GetOutNId(const int &NodeN) const
Returns ID of NodeN-th out-node (the node the current node points to).
Definition: network.h:82
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 122 of file network.h.

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

Definition at line 127 of file network.h.

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

Gets the source node of an edge.

Definition at line 124 of file network.h.

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

Increment iterator.

Definition at line 117 of file network.h.

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

Definition at line 119 of file network.h.

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

Definition at line 115 of file network.h.

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

Definition at line 120 of file network.h.

120 { return CurNode == EdgeI.CurNode && CurEdge == EdgeI.CurEdge; }
TNodeI CurNode
Definition: network.h:109

Friends And Related Function Documentation

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

Definition at line 129 of file network.h.

Member Data Documentation

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

Definition at line 110 of file network.h.

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

Definition at line 109 of file network.h.

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

Definition at line 109 of file network.h.


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