An Algorithm for enumerating All Spanning Trees of a Directed Graph - S. Kapoor and H. Ramesh Speakers: 李孟韓 1, 林蔚茵 2, 莊秋芸 3, 黃稚穎 4.

Slides:



Advertisements
Similar presentations
Chapter 11 Trees Graphs III (Trees, MSTs) Reading: Epp Chp 11.5, 11.6.
Advertisements

Chapter 5: Tree Constructions
Graph Algorithms Algorithm Design and Analysis Victor AdamchikCS Spring 2014 Lecture 11Feb 07, 2014Carnegie Mellon University.
Lecture 15. Graph Algorithms
CS 336 March 19, 2012 Tandy Warnow.
Great Theoretical Ideas in Computer Science for Some.
Two Segments Intersect?
Graphs - II Algorithms G. Miller V. Adamchik CS Spring 2014 Carnegie Mellon University.
Rizwan Rehman Centre for Computer Studies Dibrugarh University
Graph Algorithms - 4 Algorithm Design and Analysis Victor AdamchikCS Spring 2014 Lecture 14Feb 14, 2014Carnegie Mellon University.
Trees Chapter 11.
Advanced Topics in Algorithms and Data Structures
Bioinformatics Programming 1 EE, NCKU Tien-Hao Chang (Darby Chang)
WSPD Applications.
2/14/13CMPS 3120 Computational Geometry1 CMPS 3120: Computational Geometry Spring 2013 Planar Subdivisions and Point Location Carola Wenk Based on: Computational.
22C:19 Discrete Structures Trees Spring 2014 Sukumar Ghosh.
Graphs III (Trees, MSTs) (Chp 11.5, 11.6)
CMPS 2433 Discrete Structures Chapter 5 - Trees R. HALVERSON – MIDWESTERN STATE UNIVERSITY.
A Randomized Linear-Time Algorithm to Find Minimum Spaning Trees 黃則翰 R 蘇承祖 R 張紘睿 R 許智程 D 戴于晉 R David R. Karger.
Tirgul 8 Graph algorithms: Strongly connected components.
Optimization of Pearl’s Method of Conditioning and Greedy-Like Approximation Algorithm for the Vertex Feedback Set Problem Authors: Ann Becker and Dan.
Jeffrey D. Ullman Stanford University Flow Graph Theory.
A Randomized Linear-Time Algorithm to Find Minimum Spanning Trees David R. Karger David R. Karger Philip N. Klein Philip N. Klein Robert E. Tarjan.
Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 14 Strongly connected components Definition and motivation Algorithm Chapter 22.5.
Discussion #36 Spanning Trees
Topics: 1. Finding a cycle in a graph 2. Propagation delay - example 3. Trees - properties מבנה המחשב - אביב 2004 תרגול 3#
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
DAST 2005 Tirgul 11 (and more) sample questions. DAST 2005 Q.Let G = (V,E) be an undirected, connected graph with an edge weight function w : E→R. Let.
Minimal Spanning Trees. Spanning Tree Assume you have an undirected graph G = (V,E) Spanning tree of graph G is tree T = (V,E T E, R) –Tree has same set.
Data Structures, Spring 2006 © L. Joskowicz 1 Data Structures – LECTURE 14 Strongly connected components Definition and motivation Algorithm Chapter 22.5.
Minimum Spanning Trees
Module #1 - Logic 1 Based on Rosen, Discrete Mathematics & Its Applications. Prepared by (c) , Michael P. Frank and Modified By Mingwu Chen Trees.
KNURE, Software department, Ph , N.V. Bilous Faculty of computer sciences Software department, KNURE The trees.
Graph Algorithms Using Depth First Search Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Analysis of Algorithms.
Algorithms for Enumerating All Spanning Trees of Undirected and Weighted Graphs Presented by R 李孟哲 R 陳翰霖 R 張仕明 Sanjiv Kapoor and.
Approximating Minimum Bounded Degree Spanning Tree (MBDST) Mohit Singh and Lap Chi Lau “Approximating Minimum Bounded DegreeApproximating Minimum Bounded.
Approximating the Minimum Degree Spanning Tree to within One from the Optimal Degree R 陳建霖 R 宋彥朋 B 楊鈞羽 R 郭慶徵 R
Tree A connected graph that contains no simple circuits is called a tree. Because a tree cannot have a simple circuit, a tree cannot contain multiple.
CSCI 115 Chapter 7 Trees. CSCI 115 §7.1 Trees §7.1 – Trees TREE –Let T be a relation on a set A. T is a tree if there exists a vertex v 0 in A s.t. there.
Discussion #32 1/13 Discussion #32 Properties and Applications of Depth-First Search Trees.
Discrete Structures Lecture 12: Trees Ji Yanyan United International College Thanks to Professor Michael Hvidsten.
 Rooted tree and binary tree  Theorem 5.19: A full binary tree with t leaves contains i=t-1 internal vertices.
5.5.2 M inimum spanning trees  Definition 24: A minimum spanning tree in a connected weighted graph is a spanning tree that has the smallest possible.
5.5.3 Rooted tree and binary tree  Definition 25: A directed graph is a directed tree if the graph is a tree in the underlying undirected graph.  Definition.
Union Find ADT Data type for disjoint sets: makeSet(x): Given an element x create a singleton set that contains only this element. Return a locator/handle.
5.5.2 M inimum spanning trees  Definition 24: A minimum spanning tree in a connected weighted graph is a spanning tree that has the smallest possible.
1 Chapter 22 Elementary Graph Algorithms. 2 Introduction G=(V, E) –V = vertex set –E = edge set Graph representation –Adjacency list –Adjacency matrix.
 2004 SDU Lectrue4-Properties of DFS Properties of DFS Classification of edges Topological sort.
Computing Branchwidth via Efficient Triangulations and Blocks Authors: F.V. Fomin, F. Mazoit, I. Todinca Presented by: Elif Kolotoglu, ISE, Texas A&M University.
Trees Thm 2.1. (Cayley 1889) There are nn-2 different labeled trees
Properties and Applications of Depth-First Search Trees and Forests
Graph and Digraph Sung Yong Shin TC Lab. CS Dept., KAIST.
CSE 421 Algorithms Richard Anderson Winter 2009 Lecture 5.
CHAPTER 11 TREES INTRODUCTION TO TREES ► A tree is a connected undirected graph with no simple circuit. ► An undirected graph is a tree if and only.
Great Theoretical Ideas in Computer Science for Some.
1 Assignment #3 is posted: Due Thursday Nov. 15 at the beginning of class. Make sure you are also working on your projects. Come see me if you are unsure.
 2004 SDU 1 Lecture5-Strongly Connected Components.
CSE 421 Algorithms Richard Anderson Autumn 2015 Lecture 5.
5. Biconnected Components of A Graph If one city’s airport is closed by bad weather, can you still fly between any other pair of cities? If one computer.
Chapter 11. Chapter Summary  Introduction to trees (11.1)  Application of trees (11.2)  Tree traversal (11.3)  Spanning trees (11.4)
5.6 Prefix codes and optimal tree Definition 31: Codes with this property which the bit string for a letter never occurs as the first part of the bit string.
1 Schnyder’s Method. 2 Motivation Given a planar graph, we want to embed it in a grid We want the grid to be relatively small And we want an efficient.
Chapter 11. Chapter Summary Introduction to Trees Applications of Trees (not currently included in overheads) Tree Traversal Spanning Trees Minimum Spanning.
Discrete Mathematicsq
Advanced Algorithms Analysis and Design
Graph Algorithms Using Depth First Search
Enumerating Distances Using Spanners of Bounded Degree
4-4 Graph Theory Trees.
Richard Anderson Lecture 5 Graph Theory
Presentation transcript:

An Algorithm for enumerating All Spanning Trees of a Directed Graph - S. Kapoor and H. Ramesh Speakers: 李孟韓 1, 林蔚茵 2, 莊秋芸 3, 黃稚穎 4

Reference H. N. Gabow and E. W. Myers: Finding all spanning trees of directed and undirected graphs, SIAM J. Comput., Vol. 7, No. 3, S. Kapoor, V. Kumar, and H. Ramesh: An algorithm for generating all spanning trees of directed graphs, Proceedings of the Workshop on Algorithms and Data Structures, LNCS, Vol. 955, Springer-Verlag, Berlin, pp. 428–439, S. Kapoor and H. Ramesh: Algorithms for generating all spanning trees of undirected and weighted graphs, SIAM J. Comput., Vol. 24, No. 2, W. Mayeda: Graph Theory, Wiley, New York, S. Shinoda: Finding all possible directed trees of a directed graph, Electron Comm. Japan, Vol. 51-A, pp. 45–47, 1968.

Outline Introduction and Algorithm outline – 李孟韓 Main Algorithm – 林蔚茵 Correctness – 莊秋芸 Time analysis and conclusion – 黃稚穎

Definition An exchange for a spanning tree T of G rooted at v is a pair of edges (e, f), where e ∈ T, f ∈ E – T, and T – {e} ∪ {f} is a spanning tree rooted at v. A edge p ∈ E - T is back edge if its tail is an ancestor of its head in T. A edge p’ ∈ E - T is forward edge if its tail is a descendant of its head in T. v u T v u z x G back edge forward edge f x = Tail(f) V = head(f) cross edge

Property 1 Every nonback nontree edge, f, relative to a spanning tree T, may replace exactly one tree edge, e, in the spanning tree, namely, the edge having the same tail, to result in a new spanning tree rooted at the same vertex as T. x f e v u z

Property 2 A back edge cannot be exchanged for any edge in the spanning tree to get a new spanning tree. x e v u z g

Computation Tree let CD(G,v) be the computation tree which generates all spanning trees of the directed graph G with root v. a b1b1 b2b2 CD(G,v) SD a x f e v u z g

Computation Tree SD b 1 is obtained from SD a by exchanging f with e, where f is a nontree nonback edge and e is the unique tree edge with the same tail as f. a b1b1 b2b2 CD(G,v) SD b 1 pick f x f e v u z g

Computation Tree SD b 2 is the same as SD a. The significance of b 2 is that the subtree rooted at b 2 will not include f in any spanning tree. a b1b1 b2b2 CD(G,v) SD b 2 delete f x e v u z g

Computation Tree a b1b1 b2b2 CD(G,v) SD b 1 pick f x f e v u z

Computation Tree a b1b1 b2b2 CD(G,v) SD b 2 delete f x e v u z g

Lemma CD(G,v) has at its nodes all directed spanning trees of G rooted at vertex v.

An Algorithm for enumerating All Spanning Trees of a Directed Graph --- S. Kapoor and H. Ramesh Speaker: 林蔚茵 2

Algorithm Description DFS tree of G (rooted at r) –The root of the computation tree CD(G,r) For each node a of the computation tree –NB: a set of those nontree edges which are nonback w.r.t. the directed spanning tree and which are not included in Maintained as a list of nonempty lists –Each nonempty list containg edges incident upon a particular vertex –Arranged in postorder number –B: a set of those back edges w.r.t. which are not included in

Property 3 Let spanning tree T’ be obtained from spanning tree T by applying the exchange (e,f). If x is a nontree edge which is back w.r.t. T and nonback w.r.t. T’, then head(x) lies in the subtree of T rooted at tail(f), and tail(x) is a vertex which is a proper ancestor of tail(f) and a proper descendant of lca(head(f), tail(f)) in T v f e a u x head(x) tail(x) tail(f) lca(head(f),tail(f))

ALGO Main(G,r) The first edge in the first list of NB is the one having tail node with the least postorder number. CHANGES is used to store the differences from the last spanning tree generated

ALGO Gen(T) b1b1 b2b2

ALGO Compute-back-to-nonback(f,T) The sets NB and B are updated at every exchange –transferring edges from B to NB –Removal of edges from B and NB Data structure for B –For each node v of G B[v]: a list of nontree back edges in B having head vertex v A[v][p]: each element points to the first edge in its list which is incident upon a proper ancestor of node p BASE[v]: initialized to be v

ALGO Compute-back-to-nonback(f,T) (cont’d)

An Algorithm for enumerating All Spanning Trees of a Directed Graph --- S. Kapoor and H. Ramesh Speaker: 莊秋芸 3

PROPERTY 4 u v f b lca(u,v) If f =(u, v) is an edge in NB and b=lca (u,v) in SD a, then no edge in NB has its head in the subtree of SD a rooted at v and its tail on the path from b to u (b excluded).

DFS The order of the selection of the exchange edge from NB. All “exchangeable edges” must connect a vertex with higher postorder number to a vertex with lower postorder number. PROPERTY 4 (some observations) u v f b lca(u,v)

By induction on the level of x, where x is a node on the computation tree. 1.Base case: root node. 2.Induction hypothesis: assume this is true for any node x of the computation tree. 3.Consider the left and right sons b 1, b 2 of x. 1) It’s trivially true for the right son b 2. PROPERTY 4 (proof) A DFS tree with postorder number on each node.

4 23 2) For the left son b 1. PROPERTY 4 (proof) f e f 7 6 Exchange e and f

PROPERTY 4 (conclusion) u v f b lca(u,v) Since no such edges exist, there’s no nonback edges will become back edges.

LEMMA 4.1 During the construction of the computation tree the following changes to NB and B suffice after an exchange at a node a in the computation tree: a)changes from B to NB by Property 3. b)deletions from NB according to IN and OUT definitions. c)removal of RB a from B.

PROPERTY 5 If an exchange (e, f), f=(u,v) is made at a node x of the computation tree, then the subtree of SD x rooted at v is preserved as such in each of the trees generated at descendant nodes of x in the computation tree. So at node x, any edge in B incident upon a vertex in that subtree, is redundant for future computations at descendant nodes of x and may be removed from B.

PROPERTY 5 v f e u A redundant back edge computation tree x All have the same subtree rooted at v SD x

An Algorithm for enumerating All Spanning Trees of a Directed Graph --- S. Kapoor and H. Ramesh Speaker: 黃稚穎 4

LEMMA 4.4 ALGO Main outputs the changes corresponding to the compressed computation tree CD'(G,r) in O(N(r)V+V 2 ) operations. The time for manipulating the data structures NB, B, and STACK is O(V*(NBC x +1)) The total time required by ALGO Gen minus the output operations equals O(Σ(V*NBC x )) At any node x in the compressed computation tree, the above summation gives an O(N(r)V) time bound. Total output operations are O(N(r)). Computing B and NB initially require O(V 2 ) time. DFS requires O(V+E)time. Total requires O(N(r)V+V 2 +V+E+N(r)) = O(N(r)V+V 2 ) time.

LEMMA 4.5 ALGO Main requires O(V 2 ) space. –Follows from the size of the data structures involved. B requires O(V 2 )-space. NB requires O(V+E)-space. Changes stored on STACK is O(V+NBC x )-space. The total stack space required is O(V 2 +ΣNBC x ) = O(V 2 )

Complexity From LEMMA 4.4 and LEMMA 4.5 the following result follows if the above procedure is repeated with each vertex in turn as root. THEOREM 4.6. All rooted directed spanning trees can be output in O(NV+V 3 ) operations and O(V 2 ) space.