Same functionality as DoBfs with better performance.
171 if (TargetNId == StartNode)
return 0;
172 const typename PGraph::TObj::TNodeI StartNodeI =
Graph->GetNI(StartNode);
176 for (
int i = 0; i < NIdDistV.Len(); i++) {
186 const unsigned int TotalNodes =
Graph->GetNodes();
187 unsigned int UnvisitedNodes =
Graph->GetNodes();
188 while (! Frontier->
Empty()) {
190 NextFrontier->Clr(
false);
191 if (MaxDist == MxDist) {
break; }
193 UnvisitedNodes -= Frontier->
Len();
194 if (
Stage == 0 && UnvisitedNodes / Frontier->
Len() <
alpha) {
196 }
else if (
Stage == 1 && TotalNodes / Frontier->
Len() >
beta) {
201 bool targetFound =
false;
203 targetFound =
TopDownStep(NIdDistV, Frontier, NextFrontier, MaxDist, TargetNId, FollowOut, FollowIn);
205 targetFound =
BottomUpStep(NIdDistV, Frontier, NextFrontier, MaxDist, TargetNId, FollowOut, FollowIn);
208 MaxDist = NIdDistV[TargetNId];
213 TIntV *temp = Frontier;
214 Frontier = NextFrontier;
222 for (
int NId = 0; NId < NIdDistV.Len(); NId++) {
223 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)