Min-st-cut algorithm, that calculates the cut via maxflow.
More...
#include <ogdf/graphalg/MinSTCutMaxFlow.h>
|
| MinSTCutMaxFlow (bool treatAsUndirected=true, MaxFlowModule< TCost > *mfModule=new MaxFlowGoldbergTarjan< TCost >(), bool primaryCut=true, bool calculateOtherCut=true, EpsilonTest *epsilonTest=new EpsilonTest()) |
| Constructor. More...
|
|
virtual bool | call (const Graph &graph, const EdgeArray< TCost > &weight, node s, node t, List< edge > &edgeList, edge e_st=nullptr) override |
| The actual algorithm call. More...
|
|
void | call (const Graph &graph, const EdgeArray< TCost > &weights, const EdgeArray< TCost > &flow, const node source, const node target) |
| Partitions the nodes to front- and backcut. More...
|
|
virtual bool | call (const Graph &graph, node s, node t, List< edge > &edgeList, edge e_st=nullptr) override |
| The actual algorithm call. More...
|
|
bool | frontCutIsComplementOfBackCut () const |
| Returns whether the front cut is the complement of the backcut. More...
|
|
bool | isBackCutEdge (const edge e) const |
| Returns whether this edge is entering the back cut. More...
|
|
bool | isFrontCutEdge (const edge e) const |
| Returns whether this edge is leaving the front cut. More...
|
|
bool | isInBackCut (const node v) const |
| Returns whether this node is part of the back cut. More...
|
|
bool | isInFrontCut (const node v) const |
| Returns whether this node is part of the front cut. More...
|
|
bool | isOfType (const node v, cutType type) const |
| Return whether this node is of the specified type. More...
|
|
void | setEpsilonTest (EpsilonTest *et) |
| Assigns a new epsilon test. More...
|
|
| MinSTCutModule () |
| default constructor (empty) More...
|
|
virtual | ~MinSTCutModule () |
|
virtual bool | direction (edge e) |
| Returns the direction of e in the cut. More...
|
|
template<typename TCost>
class ogdf::MinSTCutMaxFlow< TCost >
Min-st-cut algorithm, that calculates the cut via maxflow.
- Template Parameters
-
TCost | The type in which the weight of the edges is given. |
Definition at line 60 of file MinSTCutMaxFlow.h.
◆ cutType
template<typename TCost >
The three types of cuts.
Enumerator |
---|
FRONT_CUT | node is in front cut
|
BACK_CUT | node is in back cut
|
NO_CUT | node is not part of any cut
|
Definition at line 119 of file MinSTCutMaxFlow.h.
◆ MinSTCutMaxFlow()
template<typename TCost >
Constructor.
- Parameters
-
treatAsUndirected | States whether or not |
mfModule | The MaxFlowModule that is used to calculate a flow. The module will be deleted, when the lifetime of this object is over. |
primaryCut | true if the algorithm should search for the mincut nearest to s, false if it should be near to t. |
calculateOtherCut | if true, the other cut (primaryCut == false : front cut, primaryCut == true : back cut) should also be calculated. Setting this to false will speed up the algorithm a bit, but some functions might not work correctly or at all. |
epsilonTest | The module used for epsilon tests. The module will be deleted, when the lifetime of this object is over. |
Definition at line 79 of file MinSTCutMaxFlow.h.
◆ call() [1/3]
template<typename TCost >
The actual algorithm call.
- Parameters
-
graph | The graph on which the min-st-cut is to be calculated. |
weight | Provides a weight for every edge. |
s | The source node. |
t | The target node. |
edgeList | This list is filled with the edges which are part of the mincut. If the graph is st-planarly embedded, this list is correctly ordered along the cut. |
e_st | An edge between s and t which is used to determine where the cut should start, nullptr elsewise. |
- Returns
- Indicates success.
Implements ogdf::MinSTCutModule< TCost >.
Definition at line 321 of file MinSTCutMaxFlow.h.
◆ call() [2/3]
template<typename TCost >
Partitions the nodes to front- and backcut.
- Parameters
-
graph | The underlying graph |
weights | The weights (aka capacity) of the edges |
flow | The precomputed flow of each edge |
source | The source of the min cut |
target | the target (aka sink) of the minimum cut |
Definition at line 365 of file MinSTCutMaxFlow.h.
◆ call() [3/3]
template<typename TCost >
The actual algorithm call.
- Parameters
-
graph | The graph on which the min-st-cut is to be calculated. |
s | The source node. |
t | The target node. |
edgeList | This list is filled with the edges which are part of the mincut. If the graph is st-planarly embedded, this list is correctly ordered along the cut. |
e_st | An edge between s and t which is used to determine where the cut should start, nullptr elsewise. |
- Returns
- Indicates success.
Implements ogdf::MinSTCutModule< TCost >.
Definition at line 98 of file MinSTCutMaxFlow.h.
◆ computeCut()
template<typename TCost >
Partitions the nodes to front and back cut.
- Parameters
-
graph | The input graph |
origEdge | Maps internal edges to edges of the the input graph. |
origNode | Maps internal nodes to nodes from the input graph. |
source | The source node. |
target | The target node. |
edgeList | A list in which the edges of the cut are stored in. |
Definition at line 256 of file MinSTCutMaxFlow.h.
◆ frontCutIsComplementOfBackCut()
template<typename TCost >
Returns whether the front cut is the complement of the backcut.
i.e. there are no nodes not assigned to one of both cut types.
- Precondition
calculateOtherCut
has to be set to true in the constructor
Definition at line 136 of file MinSTCutMaxFlow.h.
◆ isBackCutEdge()
template<typename TCost >
Returns whether this edge is entering the back cut.
Definition at line 153 of file MinSTCutMaxFlow.h.
◆ isFrontCutEdge()
template<typename TCost >
Returns whether this edge is leaving the front cut.
Definition at line 144 of file MinSTCutMaxFlow.h.
◆ isInBackCut()
template<typename TCost >
Returns whether this node is part of the back cut.
Meaning it is located in the same set as the target.
- Parameters
-
Definition at line 174 of file MinSTCutMaxFlow.h.
◆ isInFrontCut()
template<typename TCost >
Returns whether this node is part of the front cut.
Meaning it is located in the same set as the source.
Definition at line 163 of file MinSTCutMaxFlow.h.
◆ isOfType()
template<typename TCost >
Return whether this node is of the specified type.
- Parameters
-
v | the node to be tested |
type | the cut type to test for (see MinSTCut::CutType) |
- Returns
- true if the node is contained in the specified cut
Definition at line 190 of file MinSTCutMaxFlow.h.
◆ markCut()
template<typename TCost >
Mark the all nodes which are in the same cut partition as the startNode
.
- Parameters
-
startNode | Only works if this is either s or t. |
frontCut | Should be set to true, iff startNode is s. |
origNode | A function which maps the internal nodes to the nodes of the input graph. |
Definition at line 222 of file MinSTCutMaxFlow.h.
◆ setEpsilonTest()
template<typename TCost >
◆ m_backCutCount
template<typename TCost >
◆ m_calculateOtherCut
template<typename TCost >
iff true, the other (near to s for primaryCut == false, near to t for primaryCut == true) cut should also be calculated.
Setting this to false will speed up the algorithm a bit, but all functions but call
might not work correctly or at all.
Definition at line 204 of file MinSTCutMaxFlow.h.
◆ m_et
template<typename TCost >
◆ m_flow
template<typename TCost >
◆ m_frontCutCount
template<typename TCost >
◆ m_mfModule
template<typename TCost >
◆ m_nodeSet
template<typename TCost >
◆ m_primaryCut
template<typename TCost >
true if the algorithm should search for the mincut nearest to s, false if it should be near to t.
Definition at line 198 of file MinSTCutMaxFlow.h.
◆ m_totalCount
template<typename TCost >
◆ m_treatAsUndirected
template<typename TCost >
states whether or not edges are considered undirected while calculating the maxflow
Definition at line 196 of file MinSTCutMaxFlow.h.
◆ m_weight
template<typename TCost >
The documentation for this class was generated from the following file: