SNAP Library 2.4, User Reference  2015-05-11 19:40:56
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 916 of file graph.h.

Constructor & Destructor Documentation

TBPGraph::TEdgeI::TEdgeI ( )
inline

Definition at line 921 of file graph.h.

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

Definition at line 922 of file graph.h.

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

Definition at line 923 of file graph.h.

923 : CurNode(EdgeI.CurNode), EndNode(EdgeI.EndNode), CurEdge(EdgeI.CurEdge) { }
TNodeI CurNode
Definition: graph.h:918
TNodeI EndNode
Definition: graph.h:918

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 935 of file graph.h.

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

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

Definition at line 931 of file graph.h.

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

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

Definition at line 937 of file graph.h.

937 { 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:933
int TBPGraph::TEdgeI::GetRNId ( ) const
inline

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

Definition at line 939 of file graph.h.

939 { 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:935
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 933 of file graph.h.

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

Increment iterator.

Definition at line 926 of file graph.h.

926  { CurEdge++; if (CurEdge >= CurNode.GetOutDeg()) { CurEdge=0; CurNode++;
927  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:897
TNodeI CurNode
Definition: graph.h:918
TNodeI EndNode
Definition: graph.h:918
bool TBPGraph::TEdgeI::operator< ( const TEdgeI EdgeI) const
inline

Definition at line 928 of file graph.h.

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

Definition at line 924 of file graph.h.

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

Definition at line 929 of file graph.h.

929 { return CurNode == EdgeI.CurNode && CurEdge == EdgeI.CurEdge; }
TNodeI CurNode
Definition: graph.h:918

Friends And Related Function Documentation

friend class TBPGraph
friend

Definition at line 940 of file graph.h.

Member Data Documentation

int TBPGraph::TEdgeI::CurEdge
private

Definition at line 919 of file graph.h.

TNodeI TBPGraph::TEdgeI::CurNode
private

Definition at line 918 of file graph.h.

TNodeI TBPGraph::TEdgeI::EndNode
private

Definition at line 918 of file graph.h.


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