ghTreeGusfield: Gomory-Hu tree with the Gusfield's algorithm

Description Usage Arguments Details Value References See Also

View source: R/ghTreeGusfield.R


Given a connected weighted and undirected graph, the ghTreeGusfield function builds a Gomory-Hu tree with the Gusfield's algorithm.


ghTreeGusfield(nodes, arcs)



vector containing the nodes of the graph, identified by a number that goes from 1 to the order of the graph.


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:


vector containing the nodes of the Gomory-Hu tree.


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


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.

See Also

A more general function getMinimumCutTree.

optrees documentation built on May 19, 2017, 8:30 p.m.

Search within the optrees package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at

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

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