Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 312: Algorithm Design & Analysis Lecture #17: Connectedness in Graphs This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.

Similar presentations


Presentation on theme: "CS 312: Algorithm Design & Analysis Lecture #17: Connectedness in Graphs This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported."— Presentation transcript:

1 CS 312: Algorithm Design & Analysis Lecture #17: Connectedness in Graphs This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative Commons Attribution-Share Alike 3.0 Unported License Slides by: Eric Ringger, adapting figures from Dasgupta et al.

2 Announcements  Due now:  HW #13  Project #4  Wednesday: Whiteboard Experience  Friday: Early Day  Virtual Monday = Tuesday: Due  Technical Career Fair: Thursday 9am-3pm in Wilkinson Student Center  Preview: Wednesday 4:00pm in 1170 TMCB  This Week  According to schedule!

3 Objectives  Wrap up connectedness in Undirected Graphs  DFS on Directed Graphs  Understand how to linearize a DAG

4 Many Kinds of Connectedness

5 DFS Analysis “Non-committal Case”: Our generic analysis covers best and worst cases.

6 DFS Yields a Forest

7 Directed Graphs  Let’s switch gears to directed graphs now

8 DFS on Directed Graphs

9

10

11 Edge Types  Tree edges: part of the DFS forest  Forward edges: lead to a non- child descendant in the DFS tree.  Back edges: lead to an ancestor in the DFS tree.  Cross edges: lead to a node that has already been completely explored (that is, already post-visited)  lead to neither descendant nor ancestor

12 Classifying Edge Types Pre Post ?

13 Classifying Edge Types Pre Post

14 Classifying Edge Types Pre Post ?

15 Classifying Edge Types Pre Post

16 Classifying Edge Types Pre Post < ?

17 Classifying Edge Types Pre Post <

18 Classify Edge

19 Cycles  How do you detect a cycle in a directed graph?  Property: A directed graph has a cycle if and only if its depth-first search reveals a back edge.  Otherwise: a Directed Acyclic Graph (DAG)

20 Sources, Sinks, Linearization DFS Search Forest: Linearization of the DAG == Topological Ordering of the DAG: 0. Define order; 1. DFS; 2. Read off post-order values in reverse order Analysis: Input DAG:

21 Sources, Sinks, Linearization DFS Search Forest: Linearization of the DAG == Topological Ordering of the DAG: 0. Define order; 1. DFS; 2. Read off post-order values in reverse order Analysis: Input DAG:

22 Sources, Sinks, Linearization DFS Search Forest: Linearized DAG: 0. Define order; 1. DFS; 2. Read off post-order values in reverse order Analysis:

23 Sources, Sinks, Linearization  In our DAG, what do you notice about sources, sinks and post-order numbers?

24 Assignment  HW 13.5  Whiteboard Experience for Project #4


Download ppt "CS 312: Algorithm Design & Analysis Lecture #17: Connectedness in Graphs This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported."

Similar presentations


Ads by Google