SNAP Library 6.0, User Reference  2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
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 113 of file network.h.

Constructor & Destructor Documentation

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

Definition at line 118 of file network.h.

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

Definition at line 119 of file network.h.

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

Definition at line 120 of file network.h.

120 : CurNode(EdgeI.CurNode), EndNode(EdgeI.EndNode), CurEdge(EdgeI.CurEdge) { }
TNodeI EndNode
Definition: network.h:115
TNodeI CurNode
Definition: network.h:115

Member Function Documentation

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

Definition at line 134 of file network.h.

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

Gets the destination node of an edge.

Definition at line 132 of file network.h.

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

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

Definition at line 133 of file network.h.

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

Gets the source node of an edge.

Definition at line 130 of file network.h.

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

Increment iterator.

Definition at line 123 of file network.h.

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

Definition at line 125 of file network.h.

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

Definition at line 121 of file network.h.

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

Definition at line 126 of file network.h.

126 { return CurNode == EdgeI.CurNode && CurEdge == EdgeI.CurEdge; }
TNodeI CurNode
Definition: network.h:115

Friends And Related Function Documentation

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

Definition at line 135 of file network.h.

Member Data Documentation

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

Definition at line 116 of file network.h.

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

Definition at line 115 of file network.h.

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

Definition at line 115 of file network.h.


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