SNAP Library, User Reference  2012-10-02 12:56:23
SNAP, a general purpose network analysis and graph mining library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TBreathFS< PGraph > Class Template Reference

List of all members.

Public Member Functions

 TBreathFS (const PGraph &GraphPt, const bool &InitBigQ=true)
void SetGraph (const PGraph &GraphPt)
 Sets the graph to be used by the BFS to GraphPt and resets the data structures.
int DoBfs (const int &StartNode, const bool &FollowOut, const bool &FollowIn, const int &TargetNId=-1, const int &MxDist=TInt::Mx)
 Performs BFS from node id StartNode for at maps MxDist steps by only following in-links (parameter FollowIn = true) and/or out-links (parameter FollowOut = true).
int GetNVisited () const
 Returns the number of nodes visited/reached by the BFS.
void GetVisitedNIdV (TIntV &NIdV) const
 Returns the IDs of the nodes visited/reached by the BFS.
int GetHops (const int &SrcNId, const int &DstNId) const
int GetRndPath (const int &SrcNId, const int &DstNId, TIntV &PathNIdV) const

Public Attributes

PGraph Graph
TSnapQueue< int > Queue
TInt StartNId
TIntH NIdDistH

Detailed Description

template<class PGraph>
class TBreathFS< PGraph >

Breath-First-Search class. The class is meant for executing many BFSs over a fixed graph. This means that the class can keep the hash tables and queues initialized between different calls of the DoBfs() function.


Constructor & Destructor Documentation

template<class PGraph>
TBreathFS< PGraph >::TBreathFS ( const PGraph &  GraphPt,
const bool &  InitBigQ = true 
) [inline]

Member Function Documentation

template<class PGraph >
int TBreathFS< PGraph >::DoBfs ( const int &  StartNode,
const bool &  FollowOut,
const bool &  FollowIn,
const int &  TargetNId = -1,
const int &  MxDist = TInt::Mx 
)

Performs BFS from node id StartNode for at maps MxDist steps by only following in-links (parameter FollowIn = true) and/or out-links (parameter FollowOut = true).

template<class PGraph >
int TBreathFS< PGraph >::GetHops ( const int &  SrcNId,
const int &  DstNId 
) const

Returns the shortst path distance between SrcNId and DistNId. Note you have to first call DoBFs(). SrcNId must be equal to StartNode, otherwise return value is -1.

template<class PGraph>
int TBreathFS< PGraph >::GetNVisited ( ) const [inline]

Returns the number of nodes visited/reached by the BFS.

template<class PGraph >
int TBreathFS< PGraph >::GetRndPath ( const int &  SrcNId,
const int &  DstNId,
TIntV PathNIdV 
) const

Returns a random shortest path from SrcNId to DstNId. Note you have to first call DoBFs(). SrcNId must be equal to StartNode, otherwise return value is -1.

template<class PGraph>
void TBreathFS< PGraph >::GetVisitedNIdV ( TIntV NIdV) const [inline]

Returns the IDs of the nodes visited/reached by the BFS.

template<class PGraph >
void TBreathFS< PGraph >::SetGraph ( const PGraph &  GraphPt)

Sets the graph to be used by the BFS to GraphPt and resets the data structures.


Member Data Documentation

template<class PGraph>
PGraph TBreathFS< PGraph >::Graph
template<class PGraph>
TIntH TBreathFS< PGraph >::NIdDistH
template<class PGraph>
TSnapQueue<int> TBreathFS< PGraph >::Queue
template<class PGraph>
TInt TBreathFS< PGraph >::StartNId

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