Given a connected weighted and undirected graph, the
`ghTreeGusfield`

function builds a Gomory-Hu tree with
the Gusfield's algorithm.

1 | ```
ghTreeGusfield(nodes, arcs)
``` |

`nodes` |
vector containing the nodes of the graph,
identified by a number that goes from |

`arcs` |
matrix with the list of arcs of the graph. Each row represents one arc. The first two columns contain the two endpoints of each arc and the third column contains their weights. |

The Gomory-Hu tree was introduced by R. E. Gomory and T. C. Hu in 1961. Given a connected weighted and undirected graph, the Gomory-Hu tree is a weighted tree that contains the minimum s-t cuts for all s-t pairs of nodes in the graph. Gomory and Hu also developed an algorithm to find it that involves maximum flow searchs and nodes contractions.

In 1990, Dan Gusfield proposed a new algorithm that can be used to find a Gomory-Hu tree without nodes contractions and simplifies the implementation.

`ghTreeGusfield`

returns a list with:

`tree.nodes` |
vector containing the nodes of the Gomory-Hu tree. |

`tree.arcs` |
matrix containing the list of arcs of the Gomory-Hu tree. |

`stages` |
number of stages required. |

R. E. Gomory, T. C. Hu. Multi-terminal network flows. Journal of the Society for Industrial and Applied Mathematics, vol. 9, 1961.

Dan Gusfield (1990). "Very Simple Methods for All Pairs Network Flow Analysis". SIAM J. Comput. 19 (1): 143-155.

A more general function getMinimumCutTree.

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.