Algorithms for generating all spanning trees of undirected, directed and weighted graphs
We present algorithms for enumerating all spanning trees in directed, undirected and weighted graphs. The algorithms use a search tree technique to construct a computation tree. The computation tree is used to output all the spanning trees by listing the relative differences between spanning trees rather than the entire spanning trees themselves. For the undirected case, both the construction and the listing of the trees are shown to require O(N+V+E) time for a graph with V vertices, E edges and N spanning trees. This algorithm is optimal and is based on exchanging non-tree edges with tree edges in a fundamental cycle. A similar exchange technique is used to construct the computation tree for a directed graph in O(NV+V3) time. The time for listing out the trees remains O(N). For a weighted graph, we show how to sort the spanning trees by weight using the computation tree in O(N log V+VE) time.
KeywordsSpan Tree Weighted Graph Computation Tree Tree Edge Fundamental Cycle
Unable to display preview. Download preview PDF.
- ()J. P. Char: Generation of trees, 2 trees and storage of master forests, IEEE Trans. Circuit Theory, CT-15, 1968.Google Scholar
- ()Harold N. Gabow: Two algorithms for generating weighted spanning trees in order, SIAM J. Comp., Vol 6, No. 1, March 1977.Google Scholar
- ()H. N. Gabow and E. W. Myers: Finding all spanning trees of directed and undirected graphs, SIAM J. Comp., Vol 7, No. 3, Aug 1978.Google Scholar
- ()W. Mayeda: Graph Theory, John Wiley, NY 1972.Google Scholar
- ()G. J. Minty: A simple algorithm for listing all trees of a graph, IEEE Trans. Circuit Theory, CT-12, 1965.Google Scholar
- ()R. C. Read and R. E. Tarjan: Bounds on backtrack algorithms for listing cycles, paths and spanning trees, Networks, 5, No. 3, 1975.Google Scholar