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
TBPGraph::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
 Gets edge ID. Always returns -1 since only edges in multigraphs have explicit IDs. More...
 
int GetSrcNId () const
 Gets the source ('left' side) of an edge. Since the graph is undirected this is the node with smaller ID of the edge endpoints. More...
 
int GetDstNId () const
 Gets destination ('right' side) of an edge. Since the graph is undirected this is the node with greater ID of the edge endpoints. More...
 
int GetLNId () const
 Gets the ID of the node on the 'left' side of the edge. More...
 
int GetRNId () const
 Gets the ID of the node on the 'right' side of the edge. More...
 

Private Attributes

TNodeI CurNode
 
TNodeI EndNode
 
int CurEdge
 

Friends

class TBPGraph
 

Detailed Description

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

Definition at line 938 of file graph.h.

Constructor & Destructor Documentation

TBPGraph::TEdgeI::TEdgeI ( )
inline

Definition at line 943 of file graph.h.

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

Definition at line 944 of file graph.h.

944 : CurNode(NodeI), EndNode(EndNodeI), CurEdge(EdgeN) { }
TNodeI CurNode
Definition: graph.h:940
TNodeI EndNode
Definition: graph.h:940
TBPGraph::TEdgeI::TEdgeI ( const TEdgeI EdgeI)
inline

Definition at line 945 of file graph.h.

945 : CurNode(EdgeI.CurNode), EndNode(EdgeI.EndNode), CurEdge(EdgeI.CurEdge) { }
TNodeI CurNode
Definition: graph.h:940
TNodeI EndNode
Definition: graph.h:940

Member Function Documentation

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

Gets destination ('right' side) of an edge. Since the graph is undirected this is the node with greater ID of the edge endpoints.

Definition at line 957 of file graph.h.

957 { 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: graph.h:925
TNodeI CurNode
Definition: graph.h:940
int TBPGraph::TEdgeI::GetId ( ) const
inline

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

Definition at line 953 of file graph.h.

953 { return -1; }
int TBPGraph::TEdgeI::GetLNId ( ) const
inline

Gets the ID of the node on the 'left' side of the edge.

Definition at line 959 of file graph.h.

959 { return GetSrcNId(); }
int GetSrcNId() const
Gets the source ('left' side) of an edge. Since the graph is undirected this is the node with smaller...
Definition: graph.h:955
int TBPGraph::TEdgeI::GetRNId ( ) const
inline

Gets the ID of the node on the 'right' side of the edge.

Definition at line 961 of file graph.h.

961 { return GetDstNId(); }
int GetDstNId() const
Gets destination ('right' side) of an edge. Since the graph is undirected this is the node with great...
Definition: graph.h:957
int TBPGraph::TEdgeI::GetSrcNId ( ) const
inline

Gets the source ('left' side) of an edge. Since the graph is undirected this is the node with smaller ID of the edge endpoints.

Definition at line 955 of file graph.h.

955 { return CurNode.GetId(); }
int GetId() const
Returns ID of the current node.
Definition: graph.h:909
TNodeI CurNode
Definition: graph.h:940
TEdgeI& TBPGraph::TEdgeI::operator++ ( int  )
inline

Increment iterator.

Definition at line 948 of file graph.h.

948  { CurEdge++; if (CurEdge >= CurNode.GetOutDeg()) { CurEdge=0; CurNode++;
949  while (CurNode < EndNode && CurNode.GetOutDeg()==0) { CurNode++; } } return *this; }
int GetOutDeg() const
Returns out-degree of the current node (returns same as value GetDeg() since the graph is undirected)...
Definition: graph.h:919
TNodeI CurNode
Definition: graph.h:940
TNodeI EndNode
Definition: graph.h:940
bool TBPGraph::TEdgeI::operator< ( const TEdgeI EdgeI) const
inline

Definition at line 950 of file graph.h.

950 { return CurNode<EdgeI.CurNode || (CurNode==EdgeI.CurNode && CurEdge<EdgeI.CurEdge); }
TNodeI CurNode
Definition: graph.h:940
TEdgeI& TBPGraph::TEdgeI::operator= ( const TEdgeI EdgeI)
inline

Definition at line 946 of file graph.h.

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

Definition at line 951 of file graph.h.

951 { return CurNode == EdgeI.CurNode && CurEdge == EdgeI.CurEdge; }
TNodeI CurNode
Definition: graph.h:940

Friends And Related Function Documentation

friend class TBPGraph
friend

Definition at line 962 of file graph.h.

Member Data Documentation

int TBPGraph::TEdgeI::CurEdge
private

Definition at line 941 of file graph.h.

TNodeI TBPGraph::TEdgeI::CurNode
private

Definition at line 940 of file graph.h.

TNodeI TBPGraph::TEdgeI::EndNode
private

Definition at line 940 of file graph.h.


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