lecture23

# lecture23 - All-Pairs Shortest Paths Floyd-Warshall...

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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: All-Pairs Shortest Paths Floyd-Warshall Transitive Closure IE170: Algorithms in Systems Engineering: Lecture 23 Jeff Linderoth Department of Industrial and Systems Engineering Lehigh University March 26, 2007 Jeff Linderoth IE170:Lecture 23 All-Pairs Shortest Paths Floyd-Warshall Transitive Closure Taking Stock Last Time All-Pairs Shortest Paths This Time Transitive Closure (Fast) Flows in Networks Jeff Linderoth IE170:Lecture 23 All-Pairs Shortest Paths Floyd-Warshall Transitive Closure Definition Dumb DP Matrix Multiply? Transitive Closure Transitive Closure Given directed graph G = ( V,E ) . Compute graph T C ( G ) = ( V,E * ) such that e = ( i,j ) ∈ E * ⇔ ∃ path from i to j in G Transitive closure can be thought of as establishing a data structure that makes it possible to solve reachability questions (can I get to x from y ?) efficiently. After the preprocessing of constructing the transitive closure, all reachability queries can be answered in constant time by simply reporting a matrix entry. Transitive closure is fundamental in propagating the consequences of modified attributes of a graph G. Jeff Linderoth IE170:Lecture 23 All-Pairs Shortest Paths Floyd-Warshall Transitive Closure Definition Dumb DP Matrix Multiply? Applications of Transitive Closure Consider the graph underlying any spreadsheet model, where the vertices are cells and there is an edge from cell i to cell j if the result of cell j depends on cell i . When the value of a given cell is modified, the values of all reachable cells must also be updated. The identity of these cells is revealed by the transitive closure of G . Many database problems reduce to computing transitive closures, for analogous reasons. Doing it fast is important Jeff Linderoth IE170:Lecture 23 All-Pairs Shortest Paths Floyd-Warshall Transitive Closure Definition Dumb DP Matrix Multiply? Transitive Closure Algorithms 1 Perform BFS or DFS from each vertex and keep track of the vertices encountered: O ( V ( V + E )) . (Good for sparse graphs) 2 Find Strongly Connected Components. (All vertices in each component are mutually reachable). Do BFS or DFS on component graph. (In which component A is connected to component B if there exists an edge from a vertex in A to a vertex in B ) 3 You can use Warshall’s Algorithm with weights 1. (In fact you can use “bits” and make things very efficient as well) Jeff Linderoth IE170:Lecture 23 All-Pairs Shortest Paths Floyd-Warshall Transitive Closure Definitions DP Recursion Algorithm Flows in Networks G = ( V,E ) directed....
View Full Document

{[ snackBarMessage ]}

### Page1 / 6

lecture23 - All-Pairs Shortest Paths Floyd-Warshall...

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

View Full Document
Ask a homework question - tutors are online