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
|
Push relabel attr manager. More...
Public Member Functions | |
TPRManager (PNEANet &Net) | |
int | Capacity (int EId) |
int & | Flow (int EId) |
int | Label (int NId) |
int & | Excess (int NId) |
int & | EdgeNum (int NId) |
void | SetLabel (int NId, int Label) |
void | CheckGap (int GapLabel) |
Removes any gaps in node labels. More... | |
bool | HasActive () |
int | IsActive (int NId) |
int | PopActive () |
void | PushActive (int NId) |
void | RemoveActive (int NId) |
int | GetMaxLabel () |
Private Attributes | |
PNEANet & | Net |
int | CapIndex |
TIntV | FlowV |
TIntV | ExcessV |
TIntV | EdgeNumsV |
TIntV | LabelsV |
TIntV | LabelCounts |
int | LabelLimit |
int | MaxLabel |
TIntQ | ActiveNodeQ |
TIntV | ActiveNodeSet |
int | ActiveCount |
Push relabel attr manager.
Flow algorithms require 2 attributes to be defined on each edge: Capacity: The maximum amount of flow over the edge. Flow: The current amount of flow over the edge. Push Relabel requires 3 attributes to be defined on each node: Label: An estimate of the distance from this node to the sink. Push Relabel pushes flow from nodes of higher labels to those of lower labels. Excess: Sum of flows into the node minus sum of flows leaving the nodes. Push Relabel finds nodes with positive excess and pushes flow out of them. These values will never be negative. EdgeNum: Push Relabel needs to cycle through the edges of a node; this attribute keeps track of which edge the cycle is at. The TPRManager class keeps maintains all of these attributes over the course of the algorithm, mostly to make the code easier to understand. It also maintains a queue of active nodes, which are nodes with positive excess and label < N, where N is the number of nodes. Each iteration of the Push Relabel algorithm pops an active node form the queue and tries to push flow from it. The current implementation of the active queue is a FIFO queue. A highest label first scheme for the active queue is also very common.
|
inline |
Definition at line 169 of file flow.cpp.
References ActiveNodeSet, Capacity(), TSnap::CapAttrName, CapIndex, EdgeNumsV, ExcessV, FlowV, IAssert, and LabelCounts.
|
inline |
Definition at line 186 of file flow.cpp.
Referenced by TSnap::GetMaxFlowIntPR(), TSnap::GlobalRelabel(), TSnap::PushRelabel(), TSnap::PushToOutNbr(), TSnap::Relabel(), and TPRManager().
|
inline |
Removes any gaps in node labels.
This method implements the gap heuristic. During the algorithm, if some label L no longer has any nodes of that label, but there are nodes with labels K > L, then all of these nodes with labels K > L will not be able to push. Mark these nodes to no longer participate in pushing flow by setting their label to N, where N is the number of nodes.
Definition at line 221 of file flow.cpp.
References IsActive(), LabelCounts, LabelLimit, LabelsV, MaxLabel, Net, and RemoveActive().
Referenced by SetLabel().
|
inline |
Definition at line 202 of file flow.cpp.
References EdgeNumsV.
Referenced by TSnap::PushRelabel().
|
inline |
Definition at line 198 of file flow.cpp.
References ExcessV.
Referenced by TSnap::GetMaxFlowIntPR(), TSnap::GlobalRelabel(), TSnap::PushToInNbr(), and TSnap::PushToOutNbr().
|
inline |
Definition at line 190 of file flow.cpp.
References FlowV.
Referenced by TSnap::GetMaxFlowIntPR(), TSnap::GlobalRelabel(), TSnap::PushRelabel(), TSnap::PushToInNbr(), TSnap::PushToOutNbr(), and TSnap::Relabel().
|
inline |
Definition at line 268 of file flow.cpp.
References MaxLabel.
Referenced by TSnap::GetMaxFlowIntPR(), TSnap::GlobalRelabel(), and TSnap::Relabel().
|
inline |
Definition at line 235 of file flow.cpp.
References ActiveCount.
Referenced by TSnap::GetMaxFlowIntPR().
|
inline |
Definition at line 239 of file flow.cpp.
References ActiveNodeSet.
Referenced by CheckGap(), TSnap::GetMaxFlowIntPR(), and TSnap::GlobalRelabel().
|
inline |
Definition at line 194 of file flow.cpp.
References LabelsV.
Referenced by TSnap::GetMaxFlowIntPR(), TSnap::GlobalRelabel(), TSnap::PushRelabel(), TSnap::Relabel(), and SetLabel().
|
inline |
Definition at line 243 of file flow.cpp.
References ActiveCount, ActiveNodeQ, ActiveNodeSet, TQQueue< TVal >::Empty(), IAssert, TQQueue< TVal >::Pop(), and TQQueue< TVal >::Top().
Referenced by TSnap::GetMaxFlowIntPR().
|
inline |
Definition at line 257 of file flow.cpp.
References ActiveCount, ActiveNodeQ, ActiveNodeSet, and TQQueue< TVal >::Push().
Referenced by TSnap::GetMaxFlowIntPR(), and TSnap::GlobalRelabel().
|
inline |
Definition at line 263 of file flow.cpp.
References ActiveCount, and ActiveNodeSet.
Referenced by CheckGap(), and TSnap::GlobalRelabel().
|
inline |
Definition at line 206 of file flow.cpp.
References CheckGap(), Label(), LabelCounts, LabelLimit, LabelsV, MAX, and MaxLabel.
Referenced by TSnap::GetMaxFlowIntPR(), TSnap::GlobalRelabel(), and TSnap::Relabel().
|
private |
Definition at line 285 of file flow.cpp.
Referenced by HasActive(), PopActive(), PushActive(), and RemoveActive().
|
private |
Definition at line 283 of file flow.cpp.
Referenced by PopActive(), and PushActive().
|
private |
Definition at line 284 of file flow.cpp.
Referenced by IsActive(), PopActive(), PushActive(), RemoveActive(), and TPRManager().
|
private |
Definition at line 272 of file flow.cpp.
Referenced by Capacity(), and TPRManager().
|
private |
Definition at line 276 of file flow.cpp.
Referenced by EdgeNum(), and TPRManager().
|
private |
Definition at line 275 of file flow.cpp.
Referenced by Excess(), and TPRManager().
|
private |
Definition at line 273 of file flow.cpp.
Referenced by Flow(), and TPRManager().
|
private |
Definition at line 279 of file flow.cpp.
Referenced by CheckGap(), SetLabel(), and TPRManager().
|
private |
Definition at line 280 of file flow.cpp.
Referenced by CheckGap(), and SetLabel().
|
private |
Definition at line 278 of file flow.cpp.
Referenced by CheckGap(), Label(), and SetLabel().
|
private |
Definition at line 281 of file flow.cpp.
Referenced by CheckGap(), GetMaxLabel(), and SetLabel().
|
private |
Definition at line 271 of file flow.cpp.
Referenced by Capacity(), and CheckGap().