7 Finding Bridge in a Graph. What is a bridge ? A C D B F G E.

Slides:



Advertisements
Similar presentations
Graph Algorithms Algorithm Design and Analysis Victor AdamchikCS Spring 2014 Lecture 11Feb 07, 2014Carnegie Mellon University.
Advertisements

Graphs - II Algorithms G. Miller V. Adamchik CS Spring 2014 Carnegie Mellon University.
Every edge is in a red ellipse (the bags). The bags are connected in a tree. The bags an original vertex is part of are connected.
Prof. Amr Goneid, AUC1 Analysis & Design of Algorithms (CSCE 321) Prof. Amr Goneid Department of Computer Science, AUC Part R4. Disjoint Sets.
Bipartite Matching, Extremal Problems, Matrix Tree Theorem.
Chapter 10: Trees. Definition A tree is a connected undirected acyclic (with no cycle) simple graph A collection of trees is called forest.
Backtrack Algorithm for Listing Spanning Trees R. C. Read and R. E. Tarjan (1975) Presented by Levit Vadim.
Minimum Spanning Tree Sarah Brubaker Tuesday 4/22/8.
David Luebke 1 5/9/2015 CS 332: Algorithms Graph Algorithms.
Graph Searching (Graph Traversal) Algorithm Design and Analysis Week 8 Bibliography: [CLRS] – chap 22.2 –
Applications of graph traversals
Graphs-Part II Depth First Search (DFS). We Already Covered Breadth First Search(BFS) Traverses the graph one level at a time – Visit all outgoing edges.
Applications of DFS: Articulation Points and Biconnected Components
David Luebke 1 5/20/2015 CS 332: Algorithms Graph Algorithms.
Lecture 13 CSE 331 Oct 2, Announcements Please turn in your HW 3 Graded HW2, solutions to HW 3, HW 4 at the END of the class Maybe extra lectures.
Structures and Strategies for State Space Search
Using Search in Problem Solving
A tree is a simple graph satisfying: if v and w are vertices and there is a path from v to w, it is a unique simple path. a b c a b c.
COMP171 Depth-First Search.
Rooted Trees. More definitions parent of d child of c sibling of d ancestor of d descendants of g leaf internal vertex subtree root.
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.
1 7/3/2015 ITCS 6114 Graph Algorithms. 2 7/3/2015 Depth-First Search ● Depth-first search is another strategy for exploring a graph ■ Explore “deeper”
1 Structures and Strategies for State Space Search 3 3.0Introduction 3.1Graph Theory 3.2Strategies for State Space Search 3.3Using the State Space to Represent.
Depth-First Search Lecture 24 COMP171 Fall Graph / Slide 2 Depth-First Search (DFS) * DFS is another popular graph search strategy n Idea is similar.
The Travelling Salesman Algorithm A Salesman has to visit lots of different stores and return to the starting base On a graph this means visiting every.
Addition and Subtraction Investigation Algorithm for the investigation 1. Choose two or three numbers. 2. Arrange them in order, biggest first. 3. Reverse.
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.
Algorithms for Enumerating All Spanning Trees of Undirected and Weighted Graphs Presented by R 李孟哲 R 陳翰霖 R 張仕明 Sanjiv Kapoor and.
COSC 2007 Data Structures II Chapter 14 Graphs III.
CS 415 – A.I. Slide Set 5. Chapter 3 Structures and Strategies for State Space Search – Predicate Calculus: provides a means of describing objects and.
Discussion #32 1/13 Discussion #32 Properties and Applications of Depth-First Search Trees.
1 Applications of BFS and DFS CSE 2011 Winter May 2016.
Graphs.
Prim's Algorithm This algorithm starts with one node. It then, one by one, adds a node that is unconnected to the new graph to the new graph, each time.
CSC 413/513: Intro to Algorithms Graph Algorithms DFS.
Union-find Algorithm Presented by Michael Cassarino.
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.
CSC 201: Design and Analysis of Algorithms Lecture # 18 Graph Algorithms Mudasser Naseer 1 12/16/2015.
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu Lecture 20.
David Luebke 1 1/6/2016 CS 332: Algorithms Graph Algorithms.
M180: Data Structures & Algorithms in Java Trees & Binary Trees Arab Open University 1.
DISTRIBUTED ALGORITHMS Spring 2014 Prof. Jennifer Welch Set 2: Basic Graph Algorithms 1.
Week 10 - Friday.  What did we talk about last time?  Graph representations  Adjacency matrix  Adjacency lists  Depth first search.
Topological Sort: Definition
David Luebke 1 1/25/2016 CSE 207: Algorithms Graph Algorithms.
Properties and Applications of Depth-First Search Trees and Forests
Data Structures Lakshmish Ramaswamy. Tree Hierarchical data structure Several real-world systems have hierarchical concepts –Physical and biological systems.
Graph Connectivity This discussion concerns connected components of a graph. Previously, we discussed depth-first search (DFS) as a means of determining.
Hello Everyone!!! 1. Tree And Graphs 2 Features of Trees  Tree Nodes Each node have 0 or more children A node have must one parent  Binary tree Tree.
BINARY TREES Objectives Define trees as data structures Define the terms associated with trees Discuss tree traversal algorithms Discuss a binary.
S&H Planarity Test Based on PC-Trees Wen-Lian Hsu.
Design of Nonmasking Tree Algorithm Goal: design a tree construction protocol systematically by constructing its invariant and fault-span.
Tracing An Algorithm for Strongly Connected Components that uses Depth First Search Graph obtained from Text, page a-al: Geetika Tewari.
Depth-First Search Depth-first search is a strategy for exploring a graph Explore “deeper” in the graph whenever possible Edges are explored out of the.
Binary Trees "A tree may grow a thousand feet tall, but its leaves will return to its roots." -Chinese Proverb.
Depth-First Search.
Greedy Algorithms / Minimum Spanning Tree Yin Tat Lee
CS223 Advanced Data Structures and Algorithms
Graph Search Applications
Spanning Trees Discrete Mathematics.
Biconnected Graph Articulation Points
Trees.
Bridges and Articulation Points
CMSC 202 Trees.
COMP171 Depth-First Search.
CSE 373: Data Structures and Algorithms
Bridges and Articulation Points
CSE 373: Data Structures and Algorithms
Trees.
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:

7 Finding Bridge in a Graph

What is a bridge ? A C D B F G E

Why we need to find bridge(s)? A graph with a lot of bridge is weakly connected.

Articulation Point A C D B E We will not cover how to find articulation point(s) now, but it is similar to bridge’s

Trivial Algorithm

We can find bridge(s) in a graph using modified DFS algorithm.

AC D B F G E A B D E C G F A E C G

We want to gather more information from DFS, so we add ordering number and parent’s id.

AC D B F G E A B D E C G F A E C G NodeABCDEFG Order Parent-ABCCEF 1/- 2/A 3/B 4/C 5/C 6/E 7/F A is C’s ancestor, because the order number is smaller C is A’s descendant, because the order number is bigger

Notice that whenever we find an ancestor node, we actually found a cycle. We can count the cycle’s size by tracing up, using parent’s info that we stored. A B D E C G F A E C G NodeABCDEFG Order Parent-ABCCEF 1/- 2/A 3/B 4/C 5/C 6/E 7/F

Observe: Cycle AC D B F G E

DFS

NodeABCDEFG Order Parent-ABCCEF Low# Initially, low is set to order number When found an ancestor node, return its low # A node always choose smaller low # of its children A B D E C G F A E C G 1/-/1 2/A/2 3/B/3 4/C/4 5/C/5 6/E/6 7/F /B/1 2/A/1 7/F/5 6/E/5

Every pink and red edges on DFS Tree corresponds to an edge on original graph A B DE C G F A E C G 1/-/1 2/A/1 3/B/1 4/C/4 5/C/5 6/E/5 7/F/ AC D B F G E There are 3 nodes which has same order and pre number Corresponding edges of these nodes are bridges Root doesn’t have corresponding edge So we only have 2 bridges in this graph

Running Time