| 
    SNAP Library 6.0, Developer Reference
    2020-12-09 16:24:20
    
   SNAP, a general purpose, high performance system for analysis and manipulation of large networks 
   | 
 
#include <bfsdfs.h>

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.  More... | |
| 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).  More... | |
| int | DoBfsHybrid (const int &StartNode, const bool &FollowOut, const bool &FollowIn, const int &TargetNId=-1, const int &MxDist=TInt::Mx) | 
| Same functionality as DoBfs with better performance.  More... | |
| int | GetNVisited () const | 
| Returns the number of nodes visited/reached by the BFS.  More... | |
| void | GetVisitedNIdV (TIntV &NIdV) const | 
| Returns the IDs of the nodes visited/reached by the BFS.  More... | |
| 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 | 
Private Member Functions | |
| bool | TopDownStep (TIntV &NIdDistV, TIntV *Frontier, TIntV *NextFrontier, int &MaxDist, const int &TargetNId, const bool &FollowOut, const bool &FollowIn) | 
| bool | BottomUpStep (TIntV &NIdDistV, TIntV *Frontier, TIntV *NextFrontier, int &MaxDist, const int &TargetNId, const bool &FollowOut, const bool &FollowIn) | 
Private Attributes | |
| int | Stage | 
Static Private Attributes | |
| static const unsigned int | alpha = 100 | 
| static const unsigned int | beta = 20 | 
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.
      
  | 
  inline | 
      
  | 
  private | 
Definition at line 262 of file bfsdfs.h.
References TVec< TVal, TSizeTy >::Add().

| 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).
Definition at line 128 of file bfsdfs.h.
References IAssert, and TMath::Mx().
Referenced by TSnap::TSnapDetail::CmtyGirvanNewmanStep(), TSnap::GetBfsEffDiam(), TSnap::GetBfsTree(), TSnap::GetNodeEcc(), TSnap::GetNodesAtHop(), TSnap::GetNodesAtHops(), TSnap::GetShortPath(), TSnap::GetSubTreeSz(), and TSnap::PlotShortPathDistr().


| int TBreathFS< PGraph >::DoBfsHybrid | ( | const int & | StartNode, | 
| const bool & | FollowOut, | ||
| const bool & | FollowIn, | ||
| const int & | TargetNId = -1,  | 
        ||
| const int & | MxDist = TInt::Mx  | 
        ||
| ) | 
Same functionality as DoBfs with better performance.
Definition at line 168 of file bfsdfs.h.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Clr(), TVec< TVal, TSizeTy >::Empty(), IAssert, TVec< TVal, TSizeTy >::Len(), and TVec< TVal, TSizeTy >::SetVal().

| 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.
Definition at line 294 of file bfsdfs.h.
References TInt::Val.
Referenced by TSnap::TSnapDetail::CmtyGirvanNewmanStep(), and TSnap::GetShortPath().

      
  | 
  inline | 
Returns the number of nodes visited/reached by the BFS.
Definition at line 99 of file bfsdfs.h.
References THash< TKey, TDat, THashFunc >::Len().

| 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.
Definition at line 302 of file bfsdfs.h.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Clr(), TVec< TVal, TSizeTy >::Empty(), TRnd::GetUniDevInt(), IAssert, TVec< TVal, TSizeTy >::Len(), TVec< TVal, TSizeTy >::Reverse(), and TInt::Rnd.

Returns the IDs of the nodes visited/reached by the BFS.
Definition at line 101 of file bfsdfs.h.
References THash< TKey, TDat, THashFunc >::GetKeyV().

| void TBreathFS< PGraph >::SetGraph | ( | const PGraph & | GraphPt | ) | 
      
  | 
  private | 
Definition at line 231 of file bfsdfs.h.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::BegI(), TVec< TVal, TSizeTy >::EndI(), IAssert, and TVec< TVal, TSizeTy >::SetVal().

      
  | 
  staticprivate | 
      
  | 
  staticprivate | 
Definition at line 88 of file bfsdfs.h.
Referenced by TSnap::GetBfsEffDiam(), TSnap::GetBfsTree(), TSnap::GetNodeEcc(), TSnap::GetNodesAtHop(), TSnap::GetNodesAtHops(), TSnap::GetShortPath(), TSnap::GetSubTreeSz(), and TSnap::PlotShortPathDistr().
| TSnapQueue<int> TBreathFS< PGraph >::Queue | 
      
  | 
  private |