SNAP Library 4.0, User Reference  2017-07-27 13:18:06
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 1010 of file graph.h.

Constructor & Destructor Documentation

TBPGraph::TEdgeI::TEdgeI ( )
inline

Definition at line 1015 of file graph.h.

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

Definition at line 1016 of file graph.h.

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

Definition at line 1017 of file graph.h.

1017 : CurNode(EdgeI.CurNode), EndNode(EdgeI.EndNode), CurEdge(EdgeI.CurEdge) { }
TNodeI CurNode
Definition: graph.h:1012
TNodeI EndNode
Definition: graph.h:1012

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

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

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

Definition at line 1025 of file graph.h.

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

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

Definition at line 1031 of file graph.h.

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

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

Definition at line 1033 of file graph.h.

1033 { 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:1029
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 1027 of file graph.h.

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

Increment iterator.

Definition at line 1020 of file graph.h.

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

Definition at line 1022 of file graph.h.

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

Definition at line 1018 of file graph.h.

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

Definition at line 1023 of file graph.h.

1023 { return CurNode == EdgeI.CurNode && CurEdge == EdgeI.CurEdge; }
TNodeI CurNode
Definition: graph.h:1012

Friends And Related Function Documentation

friend class TBPGraph
friend

Definition at line 1034 of file graph.h.

Member Data Documentation

int TBPGraph::TEdgeI::CurEdge
private

Definition at line 1013 of file graph.h.

TNodeI TBPGraph::TEdgeI::CurNode
private

Definition at line 1012 of file graph.h.

TNodeI TBPGraph::TEdgeI::EndNode
private

Definition at line 1012 of file graph.h.


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