template<typename GR, typename CAP>
class lemon::GomoryHu< GR, CAP >
The Gomory-Hu tree is a tree on the node set of a given graph, but it may contain edges which are not in the original graph. It has the property that the minimum capacity edge of the path between two nodes in this tree has the same weight as the minimum cut in the graph between these nodes. Moreover the components obtained by removing this edge from the tree determine the corresponding minimum cut. Therefore once this tree is computed, the minimum cut between any pair of nodes can easily be obtained.
The algorithm calculates n-1 distinct minimum cuts (currently with the Preflow algorithm), thus it has
overall time complexity. It calculates a rooted Gomory-Hu tree. The structure of the tree and the edge weights can be obtained using predNode()
, predValue()
and rootDist()
. The functions minCutMap()
and minCutValue()
calculate the minimum cut and the minimum cut value between any two nodes in the graph. You can also list (iterate on) the nodes and the edges of the cuts using MinCutNodeIt
and MinCutEdgeIt
.
- Template Parameters
-
GR | The type of the undirected graph the algorithm runs on. |
CAP | The type of the edge map containing the capacities. The default map type is GR::EdgeMap<int>. |
|
| GomoryHu (const Graph &graph, const Capacity &capacity) |
| Constructor.
|
|
| ~GomoryHu () |
|
|
void | run () |
| Run the Gomory-Hu algorithm.
|
|
|
The results of the algorithm can be obtained using these functions.
run() should be called before using them.
See also MinCutNodeIt and MinCutEdgeIt.
|
Node | predNode (const Node &node) const |
| Return the predecessor node in the Gomory-Hu tree.
|
|
Value | predValue (const Node &node) const |
| Return the weight of the predecessor edge in the Gomory-Hu tree.
|
|
int | rootDist (const Node &node) const |
| Return the distance from the root node in the Gomory-Hu tree.
|
|
Value | minCutValue (const Node &s, const Node &t) const |
| Return the minimum cut value between two nodes.
|
|
template<typename CutMap > |
Value | minCutMap (const Node &s, const Node &t, CutMap &cutMap) const |
| Return the minimum cut between two nodes.
|
|