A Simple Algorithm for Listing All the Trees of a Graph
A Simple Algorithm for Listing All the Trees of a Graph
复制标题
DOI:
10.1109/tct.1965.1082385
复制
发表时间:
1965-03
期刊:
影响因子:
--
通讯作者:
G. Minty
中科院分区:
文献类型:
--
作者:
G. Minty
By “tree” is meant a maximal collection of lines which contains no circuit (simple closed curve); we ask the reader to notice what this means when the graph is not connected. We propose to list all the trees of a given graph. This problem is of interest in connection with the Kirchhoff-Feussner method [I] of solving linear electrical networks. Feussner’s paper [2] contains the germ of the idea of the present method. The method described here is easily modified to produce all the trees containing a given branch also. The Kirchhoff-Feussner method is especially valuable when some of the impedances are not constants (numbers) but variables, since matrix inversion is a tedious process unless the entries are constants. The algorithm to be described is designed for implementation by digital computer; the speed is limited almost entirely by print-out, so that a preliminary count of the number of trees should be made, using the “matrix-tree theorem”[3], to determine whether the procedure is feasible. Memory requirements for the computer are quite low, provided the trees are printed out one-at-a-time as they are found, or (if needed as intermediate results in a computation) used and erased before listing the next tree. The fundamental principle on which the algorithm is based is the following: if a branch b of a graph G is distinguished, the trees can be classified into those wh. ich contain the branch and those which do not contain the branch. If we let G1 and Gz be the graphs obtained by shrinking b to a point and deleting b, every tree of category 1 consists of a tree of G1 plus b, while every tree of category 2 consists of a tree of Gz, provided 6 is neither a self-loop nor a bridge (ie, branch which is not a circuit element). If b is a loop, it can be deleted without changing the trees, whereas, if it is a bridge, the trees of G are the trees of G1 plus b.The algorithm is as follows: imagine the graph drawn on a sheet of paper; all the branches are numbered (or otherwise marked with identification). Delete all self-loops; delete all bridges, writing their numbers at the bottom of the sheet. Use the sheet of paper to generate two other sheets, as follows: distinguish any branch and call it b. Draw Gz on one new sheet. Draw G1 on the other sheet and write the number of the branch b on the bottom of the sheet. Now reduce G1 and Gz by erasing all self-loops; also erase all bridges, but write the number of each bridge deleted at the bottom of the corresponding sheet. Transfer the numbers at the bottom of the original sheet to the bottoms of both new sheets, and discard the original.