Download Minimum Spanning Tree: Directed Graphs

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Quadtree wikipedia , lookup

Binary search tree wikipedia , lookup

Transcript
Emory University Logo Guidelines
Minimum Spanning Tree:
Directed Graphs
Data Structures and Algorithms
Emory University
Jinho D. Choi
-
Emory University Logo Guidelines
Chu–Liu-Edmonds’ Algorithm
0
1
List<Set<Integer>> forest
= initForest(graph.size());
-
20
5
2
10
4
12
6
5
28 15
2
4
7
8
4
2
3
20
30
3
Emory University Logo Guidelines
Chu–Liu-Edmonds’ Algorithm
0
1
SpanningTree tree = getMinimumIncomingEdges
(graph, forest);
20
5
2
10
4
12
6
5
28 15
2
4
7
8
4
3
3
20
30
3
Emory University Logo Guidelines
Chu–Liu-Edmonds’ Algorithm
0
1
List<List<Edge>>
cycles
= tree.getCycles();
20
5
2
10
4
12
6
5
28 15
2
4
7
8
4
4
3
20
30
3
Emory University Logo Guidelines
Chu–Liu-Edmonds’ Algorithm
0
1
forest = updateEdgeWeights
(graph, cycles);
23
20
85
2
10
4
12
6
85
28 15
2
64
7
108
4
5
3
20
30
32
3
Emory University Logo Guidelines
Chu–Liu-Edmonds’ Algorithm
0
1
SpanningTree tree = getMinimumIncomingEdges
(graph, forest);
23
8
2
10
4
12
6
8
28 15
2
6
7
10
4
6
3
20
32
3
Emory University Logo Guidelines
Chu–Liu-Edmonds’ Algorithm
0
1
addEdgesFromCycles
(tree, cyclicEdges);
23
8
2
10
4
12
6
8
28 15
2
6
7
10
4
7
3
20
32
3
Emory University Logo Guidelines
Chu–Liu-Edmonds’ Algorithm
-
0
4 →5
4 →6
4 →7
1
2
2
1
3
3
Minimum Spanning Tree?
8
Emory University Logo Guidelines
Chu–Liu-Edmonds’ Algorithm
-
0
4 →8
4 →7
4 →9
1
2
2
1
3
9
3
Emory University Logo Guidelines
Chu–Liu-Edmonds’ Algorithm
•
•
Chu–Liu-Edmonds’ algorithm
-
Finding minimum spanning trees in directed graphs.
-
Algorithm
1. Initially, every vertex is considered a tree.
2. For each tree, keep 1 incoming edge with the minimum weight.
3. If there is no cycle, go to #5.
4. If there is a cycle, merge trees with the cycle into one and update
scores for all incoming edges to this tree, and goto #2.
• For each vertex in the tree, add the weight of its outgoing edge chain to its
incoming edges not in the tree.
5. Break all cycles by removing edges that cause multiple parents.
10