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
TNGraph::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 node of the edge. More...
 
int GetDstNId () const
 Returns the destination node of the edge. More...
 

Private Attributes

TNodeI CurNode
 
TNodeI EndNode
 
int CurEdge
 

Friends

class TNGraph
 

Detailed Description

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

Definition at line 386 of file graph.h.

Constructor & Destructor Documentation

TNGraph::TEdgeI::TEdgeI ( )
inline

Definition at line 391 of file graph.h.

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

Definition at line 392 of file graph.h.

392 : CurNode(NodeI), EndNode(EndNodeI), CurEdge(EdgeN) { }
TNodeI CurNode
Definition: graph.h:388
TNodeI EndNode
Definition: graph.h:388
TNGraph::TEdgeI::TEdgeI ( const TEdgeI EdgeI)
inline

Definition at line 393 of file graph.h.

393 : CurNode(EdgeI.CurNode), EndNode(EdgeI.EndNode), CurEdge(EdgeI.CurEdge) { }
TNodeI CurNode
Definition: graph.h:388
TNodeI EndNode
Definition: graph.h:388

Member Function Documentation

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

Returns the destination node of the edge.

Definition at line 405 of file graph.h.

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

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

Definition at line 401 of file graph.h.

401 { return -1; }
int TNGraph::TEdgeI::GetSrcNId ( ) const
inline

Returns the source node of the edge.

Definition at line 403 of file graph.h.

403 { return CurNode.GetId(); }
TNodeI CurNode
Definition: graph.h:388
int GetId() const
Returns ID of the current node.
Definition: graph.h:356
TEdgeI& TNGraph::TEdgeI::operator++ ( int  )
inline

Increment iterator.

Definition at line 396 of file graph.h.

396  { CurEdge++; if (CurEdge >= CurNode.GetOutDeg()) { CurEdge=0; CurNode++;
397  while (CurNode < EndNode && CurNode.GetOutDeg()==0) { CurNode++; } } return *this; }
TNodeI CurNode
Definition: graph.h:388
TNodeI EndNode
Definition: graph.h:388
int GetOutDeg() const
Returns out-degree of the current node.
Definition: graph.h:362
bool TNGraph::TEdgeI::operator< ( const TEdgeI EdgeI) const
inline

Definition at line 398 of file graph.h.

398 { return CurNode<EdgeI.CurNode || (CurNode==EdgeI.CurNode && CurEdge<EdgeI.CurEdge); }
TNodeI CurNode
Definition: graph.h:388
TEdgeI& TNGraph::TEdgeI::operator= ( const TEdgeI EdgeI)
inline

Definition at line 394 of file graph.h.

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

Definition at line 399 of file graph.h.

399 { return CurNode == EdgeI.CurNode && CurEdge == EdgeI.CurEdge; }
TNodeI CurNode
Definition: graph.h:388

Friends And Related Function Documentation

friend class TNGraph
friend

Definition at line 406 of file graph.h.

Member Data Documentation

int TNGraph::TEdgeI::CurEdge
private

Definition at line 389 of file graph.h.

TNodeI TNGraph::TEdgeI::CurNode
private

Definition at line 388 of file graph.h.

TNodeI TNGraph::TEdgeI::EndNode
private

Definition at line 388 of file graph.h.


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