Backtrack Algorithm for Listing Spanning Trees R. C. Read and R. E. Tarjan (1975) Presented by Levit Vadim.

Slides:



Advertisements
Similar presentations
Planar Graphs: Coloring and Drawing
Advertisements

Section 3.4 The Traveling Salesperson Problem Tucker Applied Combinatorics By Aaron Desrochers and Ben Epstein.
Some Graph Algorithms.
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
BackTracking Algorithms
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2007.
Lecture 24 Coping with NPC and Unsolvable problems. When a problem is unsolvable, that's generally very bad news: it means there is no general algorithm.
10.4 Spanning Trees. Def Def: Let G be a simple graph. A spanning tree of G is a subgraph of G that is a tree containing every vertex of G See handout.
Graphs – Depth First Search ORD DFW SFO LAX
3.3 Spanning Trees Tucker, Applied Combinatorics, Section 3.3, by Patti Bodkin and Tamsen Hunter.
1 Section 9.4 Spanning Trees. 2 Let G be a simple graph. A spanning subtree of G is a subgraph of G containing every vertex of G –must be connected; contains.
Algorithms and Data Structures
Best-First Search: Agendas
Dynamic Programming CIS 606 Spring 2010.
1 Data Structures DFS, Topological Sort Dana Shapira.
Constraint Satisfaction Problems
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.
COMP171 Depth-First Search.
Is the following graph Hamiltonian- connected from vertex v? a). Yes b). No c). I have absolutely no idea v.
CSE 421 Algorithms Richard Anderson Lecture 4. What does it mean for an algorithm to be efficient?
Depth-first search COMP171 Fall Graph / Slide 2 Depth-First Search (DFS) * DFS is another popular graph search strategy n Idea is similar to pre-order.
Backtracking Reading Material: Chapter 13, Sections 1, 2, 4, and 5.
Two Discrete Optimization Problems Problem #2: The Minimum Cost Spanning Tree Problem.
Recursion Chapter 7. Chapter 7: Recursion2 Chapter Objectives To understand how to think recursively To learn how to trace a recursive method To learn.
Backtracking.
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
Depth-First Search Idea: Keep going forward as long as there are unseen nodes to be visited. Backtrack when stuck. v G G G G is completely traversed.
Theory of Computing Lecture 10 MAS 714 Hartmut Klauck.
 Jim has six children.  Chris fights with Bob,Faye, and Eve all the time; Eve fights (besides with Chris) with Al and Di all the time; and Al and Bob.
Tree Searching Breadth First Search Dept First Search.
Spring 2015 Lecture 10: Elementary Graph Algorithms
CSC 331: Algorithm Analysis Decompositions of Graphs.
Recursion Chapter 7. Chapter Objectives  To understand how to think recursively  To learn how to trace a recursive method  To learn how to write recursive.
© 2015 JW Ryder CSCI 203 Data Structures1. © 2015 JW Ryder CSCI 203 Data Structures2.
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
1 Spanning Trees Longin Jan Latecki Temple University based on slides by David Matuszek, UPenn, Rose Hoberman, CMU, Bing Liu, U. of Illinois, Boting Yang,
Introduction to Graph Theory
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Lecture 11 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
Agenda Review: –Planar Graphs Lecture Content:  Concepts of Trees  Spanning Trees  Binary Trees Exercise.
Jan Topological Order and SCC Edge classification Topological order Recognition of strongly connected components.
Chapter 9 Finding the Optimum 9.1 Finding the Best Tree.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
1 Spanning Trees Longin Jan Latecki Temple University based on slides by David Matuszek, UPenn, Rose Hoberman, CMU, Bing Liu, U. of Illinois, Boting Yang,
1 Directed Graphs Chapter 8. 2 Objectives You will be able to: Say what a directed graph is. Describe two ways to represent a directed graph: Adjacency.
© 2006 Pearson Addison-Wesley. All rights reserved 14 A-1 Chapter 14 Graphs.
CSE 421 Algorithms Richard Anderson Winter 2009 Lecture 5.
Graph Connectivity This discussion concerns connected components of a graph. Previously, we discussed depth-first search (DFS) as a means of determining.
ICS 353: Design and Analysis of Algorithms Backtracking King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Tree Diagrams A tree is a connected graph in which every edge is a bridge. There can NEVER be a circuit in a tree diagram!
Fleury's Algorithm Euler Circuit Algorithm
Chapter 11. Chapter Summary  Introduction to trees (11.1)  Application of trees (11.2)  Tree traversal (11.3)  Spanning trees (11.4)
Introduction to Algorithms
Graphs – Breadth First Search
Spanning Trees Longin Jan Latecki Temple University based on slides by
Graph Operations And Representation
Planarity Testing.
Study Guide for ES205 Yu-Chi Ho Jonathan T. Lee Nov. 7, 2000
Graphs Chapter 13.
Iterative Deepening Search
Lectures on Graph Algorithms: searching, testing and sorting
Discrete Math II Howon Kim
Depth-First Search Graph Traversals Depth-First Search DFS.
Spanning Trees Longin Jan Latecki Temple University based on slides by
Spanning Trees Longin Jan Latecki Temple University based on slides by
The Greedy Approach Young CS 530 Adv. Algo. Greedy.
ICS 353: Design and Analysis of Algorithms
Chapter 14 Graphs © 2011 Pearson Addison-Wesley. All rights reserved.
Richard Anderson Lecture 5 Graph Theory
Graph Traversals Some applications require visiting every vertex in the graph exactly once. The application may require that vertices be visited in some.
Presentation transcript:

Backtrack Algorithm for Listing Spanning Trees R. C. Read and R. E. Tarjan (1975) Presented by Levit Vadim

Abstract Describe and analyze backtrack algorithm for listing all spanning trees Time requirement: polynomial in |V|, |E| and linear in |T| Space requirement: linear in |V| and |E| Where – V number of vertices in graph – E number of edges in graph – T number of all spanning trees

Main difficulty Total number of all sub-graphs is exponential in |E|, which may be much more than T We want to visit only sub-graphs that can be extended to a spanning tree To perform this task we will restrict the search process by avoiding visiting sub-graphs that cannot be extended to those we need Otherwise, the time in waste might become much more than linear in T

Listing all sub-graphs Suppose we want to list all sub-graphs G’=(V, E’) of a given graph G=(V, E) e1 e2 e5 e3 e4 e6 e7

Search technique: Backtracking Choose some order for elements When we examine an element, we decide whether to include it into the current solution or not After we decide whether to include the current element, we continue to the next element recursively

Examine edges Examine e1 Then continue to e2 recursively e1 includenot include e1 e2 e5 e3 e4 e6 e7 e2 e5 e3 e4 e6 e7

Backtracking cont. When we have made a decision for each element in original set (whether to include it or not), we will list the set we have constructed only if it meets the criteria (in our case spanning tree) Whenever we have tried both including and excluding an element, we backtrack to the previous element, and change our decision and move forward again, if possible We can demonstrate the process by a search tree

Search tree e1 e2 e6 e7 include not include include Check if the set must be listed …

Search tree Backtrack to the previous element By continuing this process, we will explore entire search space e1 e2 e6 e7 not include e7 includenot include e2 e6 e7 … … … include …

Listing spanning trees We will use a backtrack algorithm to list all spanning trees At each stage of process, there is the current sub-graph (PST – partial spanning tree) Besides, there is the current graph (G), to choose edges from

Naïve solution

Restricting backtracking (“cutting the search tree”) Main observations: Any bridge of a graph must be included in all its spanning trees Any edge which forms a cycle with edges already included in a partial spanning tree must be not included as an additional spanning tree edge

Span algorithm

Procedure REC (listing ST’s) GPST

Procedure REC (avoiding cycles – lines 3-6)

Procedure REC (avoiding cycles) cont. The edges colored red form cycle in PST, so they must be stored at B and removed from G GPST e'

Procedure REC (including bridges – lines 9-11)

Procedure REC (including bridges) cont. Remove e’ from G and PST Return to G all edges from B Select all bridges GPST e'

Time analysis

Time analysis cont.

Time analysis (recursive calls)

Space analysis Any edge in B at some level of recursion is ether deleted from graph or included into partial spanning tree – the edge in B is deleted from graph if it forms a cycle with edges in partial tree – the edge in B is included into partial tree if it is a bridge

Space analysis cont.

Theoretical time efficiency

Number of spanning trees in graph

Proof Pick any particular spanning tree J of G and delete all edges of J from G to form a graph G’ Let J’ be a graph consisting of trees, one spanning each connected component of G’ G and JG’ and J’

Proof cont.

G and JG’ and J’