594 if (Weights[SeedNodeId].GetDat(SeedNodeId) * eps >= 1) {
598 residual(SeedNodeId) = 1;
600 NodesWExcesRes.
Push(SeedNodeId);
602 while (!NodesWExcesRes.
Empty()) {
604 int NodeId = NodesWExcesRes.
Top();
605 NodesWExcesRes.
Pop();
607 float deg_w = Weights[NodeId].
GetDat(NodeId);
609 appr_vec(NodeId) += residual(NodeId);
611 residual(NodeId) = 0;
614 float pushVal = residual(NodeId) - deg_w * eps / 2;
615 appr_vec(NodeId) += pushVal * (1-alpha);
617 residual(NodeId) = deg_w * eps / 2;
619 pushVal *= alpha / deg_w;
621 for (
int i = 0; i < NI.
GetOutDeg(); i ++) {
623 float nbrValOld = residual(NbrId);
624 float nbrValNew = nbrValOld + pushVal * Weights[NodeId].
GetDat(NbrId);
625 residual(NbrId) = nbrValNew;
626 if (nbrValOld <= eps * Weights[NbrId].GetDat(NbrId) && nbrValNew > eps * Weights[NbrId].GetDat(NbrId)) {
627 NodesWExcesRes.
Push(NbrId);
THash< TInt, TFlt > appr_vec
void computeProfile(const ProcessedGraph &graph_p)
const WeightVH & getWeights() const
Node iterator. Only forward iteration (operator++) is supported.
void Pop()
Removes the first element from the queue.
bool Empty() const
Tests whether the queue is empty (contains no elements).
int GetOutDeg() const
Returns out-degree of the current node (returns same as value GetDeg() since the graph is undirected)...
const TVal & GetDat(const TVal &Val) const
Returns reference to the first occurrence of element Val.
TNodeI GetNI(const int &NId) const
Returns an iterator referring to the node of ID NId in the graph.
int GetOutNId(const int &NodeN) const
Returns ID of NodeN-th out-node (the node the current node points to).
PUNGraph getTransformedGraph() const
void Push(const TVal &Val)
Adds an element at the end of the queue.
void Clr(const bool &DoDel=true, const int &NoDelLim=-1, const bool &ResetDat=true)
const TVal & Top() const
Returns the value of the first element in the queue, but does not remove the element.