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

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

#include <network.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 network 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 network 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 TUndirNet
 

Detailed Description

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

Definition at line 2830 of file network.h.

Constructor & Destructor Documentation

TUndirNet::TEdgeI::TEdgeI ( )
inline

Definition at line 2835 of file network.h.

2835 : CurNode(), EndNode(), CurEdge(0) { }
TUndirNet::TEdgeI::TEdgeI ( const TNodeI NodeI,
const TNodeI EndNodeI,
const int &  EdgeN = 0 
)
inline

Definition at line 2836 of file network.h.

2836 : CurNode(NodeI), EndNode(EndNodeI), CurEdge(EdgeN) { }
TUndirNet::TEdgeI::TEdgeI ( const TEdgeI EdgeI)
inline

Definition at line 2837 of file network.h.

2837 : CurNode(EdgeI.CurNode), EndNode(EdgeI.EndNode), CurEdge(EdgeI.CurEdge) { }

Member Function Documentation

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

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

Definition at line 2848 of file network.h.

2848 { 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: network.h:2815
int TUndirNet::TEdgeI::GetId ( ) const
inline

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

Definition at line 2844 of file network.h.

2844 { return -1; }
int TUndirNet::TEdgeI::GetSrcNId ( ) const
inline

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

Definition at line 2846 of file network.h.

2846 { return CurNode.GetId(); }
int GetId() const
Returns ID of the current node.
Definition: network.h:2799
TEdgeI& TUndirNet::TEdgeI::operator++ ( int  )
inline

Increment iterator.

Definition at line 2840 of file network.h.

2840 { do { CurEdge++; if (CurEdge >= CurNode.GetOutDeg()) { CurEdge=0; CurNode++; while (CurNode < EndNode && CurNode.GetOutDeg()==0) { CurNode++; } } } while (CurNode < EndNode && GetSrcNId()>GetDstNId()); return *this; }
int GetOutDeg() const
Returns out-degree of the current node (returns same as value GetDeg() since the network is undirecte...
Definition: network.h:2805
int GetDstNId() const
Returns the destination of the edge. Since the network is undirected, this is the node with a greater...
Definition: network.h:2848
int GetSrcNId() const
Returns the source of the edge. Since the network is undirected, this is the node with a smaller ID o...
Definition: network.h:2846
bool TUndirNet::TEdgeI::operator< ( const TEdgeI EdgeI) const
inline

Definition at line 2841 of file network.h.

2841 { return CurNode<EdgeI.CurNode || (CurNode==EdgeI.CurNode && CurEdge<EdgeI.CurEdge); }
TEdgeI& TUndirNet::TEdgeI::operator= ( const TEdgeI EdgeI)
inline

Definition at line 2838 of file network.h.

2838 { if (this!=&EdgeI) { CurNode=EdgeI.CurNode; EndNode=EdgeI.EndNode; CurEdge=EdgeI.CurEdge; } return *this; }
bool TUndirNet::TEdgeI::operator== ( const TEdgeI EdgeI) const
inline

Definition at line 2842 of file network.h.

2842 { return CurNode == EdgeI.CurNode && CurEdge == EdgeI.CurEdge; }

Friends And Related Function Documentation

friend class TUndirNet
friend

Definition at line 2849 of file network.h.

Member Data Documentation

int TUndirNet::TEdgeI::CurEdge
private

Definition at line 2833 of file network.h.

TNodeI TUndirNet::TEdgeI::CurNode
private

Definition at line 2832 of file network.h.

TNodeI TUndirNet::TEdgeI::EndNode
private

Definition at line 2832 of file network.h.


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