SNAP Library 3.0, User Reference
2016-07-20 17:56:49
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.
|
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.
|
inline |
|
inline |
Definition at line 206 of file flow.cpp.