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

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

#include <graph.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
 Returns edge ID. Always returns -1 since only edges in multigraphs have explicit IDs. More...
 
int GetSrcNId () const
 Returns the source of the edge. Since the graph is undirected, this is the node with a smaller ID of the edge endpoints. More...
 
int GetDstNId () const
 Returns the destination of the edge. Since the graph is undirected, this is the node with a greater ID of the edge endpoints. More...
 

Private Attributes

TNodeI CurNode
 
TNodeI EndNode
 
int CurEdge
 

Friends

class TUNGraph
 

Detailed Description

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

Definition at line 117 of file graph.h.

Constructor & Destructor Documentation

TUNGraph::TEdgeI::TEdgeI ( )
inline

Definition at line 122 of file graph.h.

122 : CurNode(), EndNode(), CurEdge(0) { }
TNodeI EndNode
Definition: graph.h:119
TNodeI CurNode
Definition: graph.h:119
TUNGraph::TEdgeI::TEdgeI ( const TNodeI NodeI,
const TNodeI EndNodeI,
const int &  EdgeN = 0 
)
inline

Definition at line 123 of file graph.h.

123 : CurNode(NodeI), EndNode(EndNodeI), CurEdge(EdgeN) { }
TNodeI EndNode
Definition: graph.h:119
TNodeI CurNode
Definition: graph.h:119
TUNGraph::TEdgeI::TEdgeI ( const TEdgeI EdgeI)
inline

Definition at line 124 of file graph.h.

124 : CurNode(EdgeI.CurNode), EndNode(EdgeI.EndNode), CurEdge(EdgeI.CurEdge) { }
TNodeI EndNode
Definition: graph.h:119
TNodeI CurNode
Definition: graph.h:119

Member Function Documentation

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

Returns the destination of the edge. Since the graph is undirected, this is the node with a greater ID of the edge endpoints.

Definition at line 135 of file graph.h.

135 { return CurNode.GetOutNId(CurEdge); }
TNodeI CurNode
Definition: graph.h:119
int GetOutNId(const int &NodeN) const
Returns ID of NodeN-th out-node (the node the current node points to).
Definition: graph.h:102
int TUNGraph::TEdgeI::GetId ( ) const
inline

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

Definition at line 131 of file graph.h.

131 { return -1; }
int TUNGraph::TEdgeI::GetSrcNId ( ) const
inline

Returns the source of the edge. Since the graph is undirected, this is the node with a smaller ID of the edge endpoints.

Definition at line 133 of file graph.h.

133 { return CurNode.GetId(); }
TNodeI CurNode
Definition: graph.h:119
int GetId() const
Returns ID of the current node.
Definition: graph.h:84
TEdgeI& TUNGraph::TEdgeI::operator++ ( int  )
inline

Increment iterator.

Definition at line 127 of file graph.h.

127 { do { CurEdge++; if (CurEdge >= CurNode.GetOutDeg()) { CurEdge=0; CurNode++; while (CurNode < EndNode && CurNode.GetOutDeg()==0) { CurNode++; } } } while (CurNode < EndNode && GetSrcNId()>GetDstNId()); return *this; }
int GetDstNId() const
Returns the destination of the edge. Since the graph is undirected, this is the node with a greater I...
Definition: graph.h:135
int GetSrcNId() const
Returns the source of the edge. Since the graph is undirected, this is the node with a smaller ID of ...
Definition: graph.h:133
TNodeI EndNode
Definition: graph.h:119
int GetOutDeg() const
Returns out-degree of the current node (returns same as value GetDeg() since the graph is undirected)...
Definition: graph.h:90
TNodeI CurNode
Definition: graph.h:119
bool TUNGraph::TEdgeI::operator< ( const TEdgeI EdgeI) const
inline

Definition at line 128 of file graph.h.

128 { return CurNode<EdgeI.CurNode || (CurNode==EdgeI.CurNode && CurEdge<EdgeI.CurEdge); }
TNodeI CurNode
Definition: graph.h:119
TEdgeI& TUNGraph::TEdgeI::operator= ( const TEdgeI EdgeI)
inline

Definition at line 125 of file graph.h.

125 { if (this!=&EdgeI) { CurNode=EdgeI.CurNode; EndNode=EdgeI.EndNode; CurEdge=EdgeI.CurEdge; } return *this; }
TNodeI EndNode
Definition: graph.h:119
TNodeI CurNode
Definition: graph.h:119
bool TUNGraph::TEdgeI::operator== ( const TEdgeI EdgeI) const
inline

Definition at line 129 of file graph.h.

129 { return CurNode == EdgeI.CurNode && CurEdge == EdgeI.CurEdge; }
TNodeI CurNode
Definition: graph.h:119

Friends And Related Function Documentation

friend class TUNGraph
friend

Definition at line 136 of file graph.h.

Member Data Documentation

int TUNGraph::TEdgeI::CurEdge
private

Definition at line 120 of file graph.h.

TNodeI TUNGraph::TEdgeI::CurNode
private

Definition at line 119 of file graph.h.

TNodeI TUNGraph::TEdgeI::EndNode
private

Definition at line 119 of file graph.h.


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