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
TNGraphMP::TEdgeI Class Reference

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

#include <graphmp.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 destination node of an edge. More...
 

Private Attributes

TNodeI CurNode
 
TNodeI EndNode
 
int CurEdge
 

Friends

class TNGraphMP
 

Detailed Description

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

Definition at line 99 of file graphmp.h.

Constructor & Destructor Documentation

TNGraphMP::TEdgeI::TEdgeI ( )
inline

Definition at line 104 of file graphmp.h.

104 : CurNode(), EndNode(), CurEdge(0) { }
TNodeI CurNode
Definition: graphmp.h:101
TNodeI EndNode
Definition: graphmp.h:101
TNGraphMP::TEdgeI::TEdgeI ( const TNodeI NodeI,
const TNodeI EndNodeI,
const int &  EdgeN = 0 
)
inline

Definition at line 105 of file graphmp.h.

105 : CurNode(NodeI), EndNode(EndNodeI), CurEdge(EdgeN) { }
TNodeI CurNode
Definition: graphmp.h:101
TNodeI EndNode
Definition: graphmp.h:101
TNGraphMP::TEdgeI::TEdgeI ( const TEdgeI EdgeI)
inline

Definition at line 106 of file graphmp.h.

106 : CurNode(EdgeI.CurNode), EndNode(EdgeI.EndNode), CurEdge(EdgeI.CurEdge) { }
TNodeI CurNode
Definition: graphmp.h:101
TNodeI EndNode
Definition: graphmp.h:101

Member Function Documentation

int TNGraphMP::TEdgeI::GetDstNId ( ) const
inline

Gets destination node of an edge.

Definition at line 118 of file graphmp.h.

118 { return CurNode.GetOutNId(CurEdge); }
int GetOutNId(const int &NodeN) const
Returns ID of NodeN-th out-node (the node the current node points to).
Definition: graphmp.h:85
TNodeI CurNode
Definition: graphmp.h:101
int TNGraphMP::TEdgeI::GetId ( ) const
inline

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

Definition at line 114 of file graphmp.h.

114 { return -1; }
int TNGraphMP::TEdgeI::GetSrcNId ( ) const
inline

Gets the source node of an edge.

Definition at line 116 of file graphmp.h.

116 { return CurNode.GetId(); }
int GetId() const
Returns ID of the current node.
Definition: graphmp.h:69
TNodeI CurNode
Definition: graphmp.h:101
TEdgeI& TNGraphMP::TEdgeI::operator++ ( int  )
inline

Increment iterator.

Definition at line 109 of file graphmp.h.

109  { CurEdge++; if (CurEdge >= CurNode.GetOutDeg()) { CurEdge=0; CurNode++;
110  while (CurNode < EndNode && CurNode.GetOutDeg()==0) { CurNode++; } } return *this; }
int GetOutDeg() const
Returns out-degree of the current node.
Definition: graphmp.h:75
TNodeI CurNode
Definition: graphmp.h:101
TNodeI EndNode
Definition: graphmp.h:101
bool TNGraphMP::TEdgeI::operator< ( const TEdgeI EdgeI) const
inline

Definition at line 111 of file graphmp.h.

111 { return CurNode<EdgeI.CurNode || (CurNode==EdgeI.CurNode && CurEdge<EdgeI.CurEdge); }
TNodeI CurNode
Definition: graphmp.h:101
TEdgeI& TNGraphMP::TEdgeI::operator= ( const TEdgeI EdgeI)
inline

Definition at line 107 of file graphmp.h.

107 { if (this!=&EdgeI) { CurNode=EdgeI.CurNode; EndNode=EdgeI.EndNode; CurEdge=EdgeI.CurEdge; } return *this; }
TNodeI CurNode
Definition: graphmp.h:101
TNodeI EndNode
Definition: graphmp.h:101
bool TNGraphMP::TEdgeI::operator== ( const TEdgeI EdgeI) const
inline

Definition at line 112 of file graphmp.h.

112 { return CurNode == EdgeI.CurNode && CurEdge == EdgeI.CurEdge; }
TNodeI CurNode
Definition: graphmp.h:101

Friends And Related Function Documentation

friend class TNGraphMP
friend

Definition at line 119 of file graphmp.h.

Member Data Documentation

int TNGraphMP::TEdgeI::CurEdge
private

Definition at line 102 of file graphmp.h.

TNodeI TNGraphMP::TEdgeI::CurNode
private

Definition at line 101 of file graphmp.h.

TNodeI TNGraphMP::TEdgeI::EndNode
private

Definition at line 101 of file graphmp.h.


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