Edmonds' algorithm
Graph and tree search algorithms |
---|
Listings |
|
Related topics |
In graph theory, a branch of mathematics, Edmonds' algorithm or Chu–Liu/Edmonds' algorithm is an algorithm for finding a maximum or minimum optimum branchings. This is similar to the minimum spanning tree problem which concerns undirected graphs. However, when nodes are connected by weighted edges that are directed, a minimum spanning tree algorithm cannot be used.
The optimum branching algorithm was proposed independently first by Yoeng-jin Chu and Tseng-hong Liu (1965) and then by Edmonds (1967). To find a maximum path length, the largest edge value is found and connected between the two nodes, then the next largest value, and so on. If an edge creates a loop, it is erased. A minimum path length is found by starting from the smallest value.
Running time
The running time of this algorithm is . A faster implementation of the algorithm due to Robert Tarjan runs in time for sparse graphs and for dense graphs. This is as fast as Prim's algorithm for an undirected minimum spanning tree. In 1986, Gabow, Galil, Spencer, and Tarjan produced a faster implementation, with running time .
Algorithm
Description
The algorithm has a conceptual recursive description. We will denote by the function which, given a weighted directed graph with a distinguished vertex called the root, returns a spanning tree rooted at of minimal cost.
The precise description is as follows. Given a weighted directed graph with root we first replace any set of parallel edges (edges between the same pair of vertices in the same direction) by a single edge with weight equal to the minimum of the weights of these parallel edges.
Now, for each node other than the root, mark an (arbitrarily chosen) incoming edge of lowest cost. Denote the other endpoint of this edge by . The edge is now denoted as with associated cost . If the marked edges form an SRT (Shortest Route Tree), is defined to be this SRT. Otherwise, the set of marked edges form at least one cycle. Call (an arbitrarily chosen) one of these cycles . We now define a weighted directed graph having a root as follows. The nodes of are the nodes of not in plus a new node denoted .
If is an edge in with and , then include in the edge , and define .
If is an edge in with and , then include in the edge , and define .
If is an edge in with and , then include in the edge , and define .
We include no other edges in .
The root of is simply the root in .
Using a call to , find an SRT of . First, mark in all shared edges with that are marked in the SRT of . Also, mark in all the edges in . Now, suppose that in the SRT of , the (unique) incoming edge at is . This edge comes from some pair with and . Unmark and mark . Also, for each marked in the SRT of and coming from an edge in with and , mark the edge . Now the set of marked edges do form an SRT, which we define to be the value of .
Observe that is defined in terms of for weighted directed rooted graphs having strictly fewer vertices than , and finding for a single-vertex graph is trivial.
Implementation
Let BV be a vertex bucket and BE be an edge bucket. Let v be a vertex and e be an edge of maximum positive weight that is incident to v. Ci is a circuit. G0 = (V0,E0) is the original digraph. ui is a replacement vertex for Ci.
i=0
A:
if then goto B
for some vertex and {
find an edge such that w(e) = max{ w(y,v)|(y,v) Ei}
if w(e) ≤ 0 then goto A
}
if contains a circuit {
i=i+1
construct by shrinking to
modify BE, BV and some edge weights
}
goto A
B:
while i ≠ 0 {
reconstruct and rename some edges in BE
if was a root of an out-tree in BE {
and
}else{
and
}
i=i-1
}
Maximum branching weight =
References
- Y. J. Chu and T. H. Liu, "On the Shortest Arborescence of a Directed Graph", Science Sinica, vol. 14, 1965, pp. 1396–1400.
- J. Edmonds, “Optimum Branchings”, J. Res. Nat. Bur. Standards, vol. 71B, 1967, pp. 233–240.
- R. E. Tarjan, "Finding Optimum Branchings", Networks, v.7, 1977, pp. 25–35.
- P.M. Camerini, L. Fratta, and F. Maffioli, "A note on finding optimum branchings", Networks, v.9, 1979, pp. 309–312.
- Alan Gibbons Algorithmic Graph Theory, Cambridge University press, 1985 ISBN 0-521-28881-9
- H. N. Gabow, Z. Galil, T. Spencer, and R. E. Tarjan, “Efficient algorithms for finding minimum spanning trees in undirected and directed graphs,” Combinatorica 6 (1986), 109-122.
External links
- The Directed Minimum Spanning Tree Problem Description of the algorithm summarized by Shanchieh Jay Yang, May 2000.
- Edmonds's algorithm ( edmonds-alg ) – An open source implementation of Edmonds's algorithm written in C++ and licensed under the MIT License. This source is using Tarjan's implementation for the dense graph.