SNAP Library 2.0, Developer Reference  2013-05-13 16:33:57
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TUNGraph::TEdgeI Class Reference

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

#include <graph.h>

Collaboration diagram for TUNGraph::TEdgeI:

List of all members.

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.
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.
int GetSrcNId () const
 Gets the source of an edge. Since the graph is undirected this is the node with smaller ID of the edge endpoints.
int GetDstNId () const
 Gets destination of an edge. Since the graph is undirected this is the node with greater ID of the edge endpoints.

Private Attributes

TNodeI CurNode
TNodeI EndNode
int CurEdge

Friends

class TUNGraph

Detailed Description

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

Definition at line 111 of file graph.h.


Constructor & Destructor Documentation

Definition at line 116 of file graph.h.

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

Definition at line 117 of file graph.h.

: CurNode(NodeI), EndNode(EndNodeI), CurEdge(EdgeN) { }
TUNGraph::TEdgeI::TEdgeI ( const TEdgeI EdgeI) [inline]

Definition at line 118 of file graph.h.

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

Member Function Documentation

int TUNGraph::TEdgeI::GetDstNId ( ) const [inline]

Gets destination of an edge. Since the graph is undirected this is the node with greater ID of the edge endpoints.

Definition at line 129 of file graph.h.

References CurEdge, CurNode, and TUNGraph::TNodeI::GetOutNId().

Referenced by TUNGraph::AddEdge(), and operator++().

{ return CurNode.GetOutNId(CurEdge); }

Here is the call graph for this function:

Here is the caller graph for this function:

int TUNGraph::TEdgeI::GetId ( ) const [inline]

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

Definition at line 125 of file graph.h.

{ return -1; }
int TUNGraph::TEdgeI::GetSrcNId ( ) const [inline]

Gets the source of an edge. Since the graph is undirected this is the node with smaller ID of the edge endpoints.

Definition at line 127 of file graph.h.

References CurNode, and TUNGraph::TNodeI::GetId().

Referenced by TUNGraph::AddEdge(), and operator++().

{ return CurNode.GetId(); }

Here is the call graph for this function:

Here is the caller graph for this function:

TEdgeI& TUNGraph::TEdgeI::operator++ ( int  ) [inline]

Increment iterator.

Definition at line 121 of file graph.h.

References CurEdge, CurNode, EndNode, GetDstNId(), TUNGraph::TNodeI::GetOutDeg(), and GetSrcNId().

{ do { CurEdge++; if (CurEdge >= CurNode.GetOutDeg()) { CurEdge=0; CurNode++; while (CurNode < EndNode && CurNode.GetOutDeg()==0) { CurNode++; } } } while (CurNode < EndNode && GetSrcNId()>GetDstNId()); return *this; }

Here is the call graph for this function:

bool TUNGraph::TEdgeI::operator< ( const TEdgeI EdgeI) const [inline]

Definition at line 122 of file graph.h.

References CurEdge, and CurNode.

{ return CurNode<EdgeI.CurNode || (CurNode==EdgeI.CurNode && CurEdge<EdgeI.CurEdge); }
TEdgeI& TUNGraph::TEdgeI::operator= ( const TEdgeI EdgeI) [inline]

Definition at line 119 of file graph.h.

References CurEdge, CurNode, and EndNode.

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

Definition at line 123 of file graph.h.

References CurEdge, and CurNode.

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

Friends And Related Function Documentation

friend class TUNGraph [friend]

Definition at line 130 of file graph.h.


Member Data Documentation

Definition at line 114 of file graph.h.

Referenced by GetDstNId(), operator++(), operator<(), operator=(), and operator==().

Definition at line 113 of file graph.h.

Referenced by GetDstNId(), GetSrcNId(), operator++(), operator<(), operator=(), and operator==().

Definition at line 113 of file graph.h.

Referenced by operator++(), and operator=().


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