|
SNAP Library 2.1, Developer Reference
2013-09-25 10:47:25
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
Strongly connected componetns Depht-First-Search visitor class. More...
#include <cncom.h>

Public Member Functions | |
| TSccVisitor (const PGraph &_Graph) | |
| void | DiscoverNode (int NId) |
| void | FinishNode (const int &NId) |
| void | ExamineEdge (const int &NId1, const int &NId2) |
| void | TreeEdge (const int &NId1, const int &NId2) |
| void | BackEdge (const int &NId1, const int &NId2) |
| void | FwdEdge (const int &NId1, const int &NId2) |
| int | GetMinDiscTm (const int &NId1, const int &NId2) const |
Public Attributes | |
| PGraph | Graph |
| THash< TInt, TIntPr > | TmRtH |
| TSStack< TInt > | Stack |
| TInt | Time |
| TIntH | SccCntH |
| TCnComV | CnComV |
Strongly connected componetns Depht-First-Search visitor class.
| TSccVisitor< PGraph, OnlyCount >::TSccVisitor | ( | const PGraph & | _Graph | ) | [inline] |
| void TSccVisitor< PGraph, OnlyCount >::BackEdge | ( | const int & | NId1, |
| const int & | NId2 | ||
| ) | [inline] |
| void TSccVisitor< PGraph, OnlyCount >::DiscoverNode | ( | int | NId | ) | [inline] |
Definition at line 242 of file cncom.h.
References THash< TKey, TDat, THashFunc >::AddDat(), TSStack< TVal >::Push(), TSccVisitor< PGraph, OnlyCount >::Stack, TSccVisitor< PGraph, OnlyCount >::Time, and TSccVisitor< PGraph, OnlyCount >::TmRtH.
{
Time++; TmRtH.AddDat(NId, TIntPr(-Time, NId)); // negative time -- node not yet in any SCC
Stack.Push(NId); }

| void TSccVisitor< PGraph, OnlyCount >::ExamineEdge | ( | const int & | NId1, |
| const int & | NId2 | ||
| ) | [inline] |
| void TSccVisitor< PGraph, OnlyCount >::FinishNode | ( | const int & | NId | ) | [inline] |
Definition at line 245 of file cncom.h.
References TCnCom::Add(), TVec< TVal, TSizeTy >::Add(), THash< TKey, TDat, THashFunc >::AddDat(), THash< TKey, TDat, THashFunc >::GetDat(), TSccVisitor< PGraph, OnlyCount >::GetMinDiscTm(), TSccVisitor< PGraph, OnlyCount >::Graph, TVec< TVal, TSizeTy >::Last(), TSStack< TVal >::Pop(), TSccVisitor< PGraph, OnlyCount >::SccCntH, TSccVisitor< PGraph, OnlyCount >::Stack, TSccVisitor< PGraph, OnlyCount >::TmRtH, TSStack< TVal >::Top(), TPair< TVal1, TVal2 >::Val1, and TPair< TVal1, TVal2 >::Val2.
{
typename PGraph::TObj::TNodeI NI = Graph->GetNI(NId);
TIntPr& TmRtN = TmRtH.GetDat(NId);
int W = -1, Cnt = 0;
for (int i = 0; i < NI.GetOutDeg(); i++) {
W = NI.GetOutNId(i);
const TIntPr& TmRtW = TmRtH.GetDat(W);
if (TmRtW.Val1 < 0) { // node not yet in any SCC
TmRtN.Val2 = GetMinDiscTm(TmRtN.Val2, TmRtW.Val2); } }
if (TmRtN.Val2 == NId) {
if (! OnlyCount) { CnComV.Add(); }
do { W = Stack.Top(); Stack.Pop();
if (OnlyCount) { Cnt++; } else { CnComV.Last().Add(W); }
TmRtH.GetDat(W).Val1 = abs(TmRtH.GetDat(W).Val1); // node is in SCC
} while (W != NId);
if (OnlyCount) { SccCntH.AddDat(Cnt) += 1; } } }

| void TSccVisitor< PGraph, OnlyCount >::FwdEdge | ( | const int & | NId1, |
| const int & | NId2 | ||
| ) | [inline] |
| int TSccVisitor< PGraph, OnlyCount >::GetMinDiscTm | ( | const int & | NId1, |
| const int & | NId2 | ||
| ) | const [inline] |
Definition at line 265 of file cncom.h.
References THash< TKey, TDat, THashFunc >::GetDat(), TSccVisitor< PGraph, OnlyCount >::TmRtH, and TPair< TVal1, TVal2 >::Val1.
Referenced by TSccVisitor< PGraph, OnlyCount >::FinishNode().


| void TSccVisitor< PGraph, OnlyCount >::TreeEdge | ( | const int & | NId1, |
| const int & | NId2 | ||
| ) | [inline] |
| TCnComV TSccVisitor< PGraph, OnlyCount >::CnComV |
Definition at line 238 of file cncom.h.
Referenced by TSnap::GetSccs().
| PGraph TSccVisitor< PGraph, OnlyCount >::Graph |
Definition at line 233 of file cncom.h.
Referenced by TSccVisitor< PGraph, OnlyCount >::FinishNode().
| TIntH TSccVisitor< PGraph, OnlyCount >::SccCntH |
Definition at line 237 of file cncom.h.
Referenced by TSccVisitor< PGraph, OnlyCount >::FinishNode(), and TSnap::GetSccSzCnt().
| TSStack<TInt> TSccVisitor< PGraph, OnlyCount >::Stack |
Definition at line 235 of file cncom.h.
Referenced by TSccVisitor< PGraph, OnlyCount >::DiscoverNode(), and TSccVisitor< PGraph, OnlyCount >::FinishNode().
| TInt TSccVisitor< PGraph, OnlyCount >::Time |
Definition at line 236 of file cncom.h.
Referenced by TSccVisitor< PGraph, OnlyCount >::DiscoverNode().
| THash<TInt, TIntPr> TSccVisitor< PGraph, OnlyCount >::TmRtH |
Definition at line 234 of file cncom.h.
Referenced by TSccVisitor< PGraph, OnlyCount >::DiscoverNode(), TSccVisitor< PGraph, OnlyCount >::FinishNode(), and TSccVisitor< PGraph, OnlyCount >::GetMinDiscTm().