Digraphs

# Digraphs - Shortest Path 4/1/2003 8:40 AM Outline and...

This preview shows pages 1–3. Sign up to view the full content.

Directed Graphs 1 Directed Graphs JFK BOS MIA ORD LAX DFW SFO Directed Graphs 2 Outline and Reading (§12.4) Reachability (§12.4.1) ± Directed DFS ± Strong connectivity Transitive closure (§12.4.2) ± The Floyd-Warshall Algorithm Directed Acyclic Graphs (DAG’s) (§12.4.3) ± Topological Sorting Directed Graphs 3 Digraphs A digraph is a graph whose edges are all directed ± Short for “directed graph” Applications ± one-way streets ± flights ± task scheduling A C E B D Directed Graphs 4 Digraph Properties A graph G=(V,E) such that ± Each edge goes in one direction: ² Edge (a,b ) goes from a to b , but not b to a. If G is simple, m < n*(n-1). If we keep in-edges and out-edges in separate adjacency lists, we can perform listing of in- edges and out-edges in time proportional to their size. A C E B D Directed Graphs 5 Digraph Application Scheduling: edge (a,b ) means task a must be completed before b can be started The good life ics141 ics131 ics121 ics53 ics52 ics51 ics23 ics22 ics21 ics161 ics151 ics171 Directed Graphs 6 Directed DFS We can specialize the traversal algorithms (DFS and BFS) to digraphs by traversing edges only along their direction In the directed DFS algorithm, we have four types of edges ± discovery edges ± back edges ± forward edges ± cross edges A directed DFS starting a a vertex s determines the vertices reachable from s A C E B D

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Directed Graphs 7 Reachability DFS tree rooted at v: vertices reachable from v via directed paths A C E B D F A C E D A C E B D F Directed Graphs 8 Strong Connectivity Each vertex can reach all other vertices a d c b e f g Directed Graphs 9 Pick a vertex v in G. Perform a DFS from v in G.
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/02/2012 for the course CS 251 taught by Professor Staff during the Fall '08 term at Purdue.

### Page1 / 6

Digraphs - Shortest Path 4/1/2003 8:40 AM Outline and...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online