Same functionality as DoBfs with better performance.
162 if (TargetNId == StartNode)
return 0;
163 const typename PGraph::TObj::TNodeI StartNodeI =
Graph->GetNI(StartNode);
167 for (
int i = 0; i < NIdDistV.Len(); i++) {
177 const unsigned int TotalNodes =
Graph->GetNodes();
178 unsigned int UnvisitedNodes =
Graph->GetNodes();
179 while (! Frontier->
Empty()) {
181 NextFrontier->Clr(
false);
182 if (MaxDist == MxDist) {
break; }
184 UnvisitedNodes -= Frontier->
Len();
185 if (
Stage == 0 && UnvisitedNodes / Frontier->
Len() <
alpha) {
187 }
else if (
Stage == 1 && TotalNodes / Frontier->
Len() >
beta) {
192 bool targetFound =
false;
194 targetFound =
TopDownStep(NIdDistV, Frontier, NextFrontier, MaxDist, TargetNId, FollowOut, FollowIn);
196 targetFound =
BottomUpStep(NIdDistV, Frontier, NextFrontier, MaxDist, TargetNId, FollowOut, FollowIn);
199 MaxDist = NIdDistV[TargetNId];
204 TIntV *temp = Frontier;
205 Frontier = NextFrontier;
213 for (
int NId = 0; NId < NIdDistV.Len(); NId++) {
214 if (NIdDistV[NId] != -1) {
bool BottomUpStep(TIntV &NIdDistV, TIntV *Frontier, TIntV *NextFrontier, int &MaxDist, const int &TargetNId, const bool &FollowOut, const bool &FollowIn)
static const unsigned int beta
bool TopDownStep(TIntV &NIdDistV, TIntV *Frontier, TIntV *NextFrontier, int &MaxDist, const int &TargetNId, const bool &FollowOut, const bool &FollowIn)
TSizeTy Len() const
Returns the number of elements in the vector.
static const unsigned int alpha
bool Empty() const
Tests whether the vector is empty.
void SetVal(const TSizeTy &ValN, const TVal &Val)
Sets the value of element at position ValN to Val.
void Clr(const bool &DoDel=true, const int &NoDelLim=-1, const bool &ResetDat=true)
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
TDat & AddDat(const TKey &Key)