This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: if e is not explored: if vertex w is unexplored: label e as a discovered edge DFS(w) else: label e as a back edge example black edges: discovered gray edges: back Directed Graph (digraph) (12.4, p. 611) a graph with directional edges oneway streets Makefile dependencies terms acyclic strongly connected: each vertex can reach all other vertices each strongly connected subgraph must be cyclic Transitive Closure (12.4.2, p. 615) denoted G* if there is a path ABC, add an edge AC computation DFS for each vertex v: for each vertex w in DFS(v): add (v,w) to G* FloydWarshall algorithm G* = G for k = 1 upto n for j = 1 upto n for i = 1 upto n if (i != j && j != k && i != k && (vi, vk) in G* G* += (vi, vj) comparably costly: O(n^3) FloydWarshall is easier to implement DFS only wins if the graph is sparse and represented w/ an adjacency list...
View
Full
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 University.
 Fall '08
 Staff
 Data Structures, Sort

Click to edit the document details