Laura TomaSimplified External memory Algorithms for Planar DAGs Simplified External Memory Algorithms for Planar DAGs July 2004 Lars Arge Laura Toma Duke.

Slides:



Advertisements
Similar presentations
Algorithms (and Datastructures) Lecture 3 MAS 714 part 2 Hartmut Klauck.
Advertisements

Lecture 7. Network Flows We consider a network with directed edges. Every edge has a capacity. If there is an edge from i to j, there is an edge from.
Lecture 7 March 1, 11 discuss HW 2, Problem 3
Cpt S 223 – Advanced Data Structures Graph Algorithms: Introduction
I/O-Algorithms Lars Arge Fall 2014 September 25, 2014.
Topological Sort Topological sort is the list of vertices in the reverse order of their finishing times (post-order) of the depth-first search. Topological.
Tirgul 7 Review of graphs Graph algorithms: –DFS –Properties of DFS –Topological sort.
CSE 2331/5331 Topic 11: Basic Graph Alg. Representations Undirected graph Directed graph Topological sort.
Graph A graph, G = (V, E), is a data structure where: V is a set of vertices (aka nodes) E is a set of edges We use graphs to represent relationships among.
External Memory Geometric Data Structures
BFS and DFS BFS and DFS in directed graphs BFS in undirected graphs An improved undirected BFS-algorithm.
CSE332: Data Abstractions Lecture 16: Topological Sort / Graph Traversals Tyler Robison Summer
Chapter 9 Graph algorithms. Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
I/O-Algorithms Lars Arge Aarhus University February 16, 2006.
I/O-Algorithms Lars Arge Aarhus University February 7, 2005.
Connected Components, Directed Graphs, Topological Sort COMP171.
Course Review COMP171 Spring Hashing / Slide 2 Elementary Data Structures * Linked lists n Types: singular, doubly, circular n Operations: insert,
Chapter 9 Graph algorithms Lec 21 Dec 1, Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
Efficient Algorithms for Large-Scale GIS Applications Laura Toma Duke University.
CSE 421 Algorithms Richard Anderson Lecture 4. What does it mean for an algorithm to be efficient?
Connected Components, Directed Graphs, Topological Sort Lecture 25 COMP171 Fall 2006.
CS344: Lecture 16 S. Muthu Muthukrishnan. Graph Navigation BFS: DFS: DFS numbering by start time or finish time. –tree, back, forward and cross edges.
DAST 2005 Tirgul 12 (and more) sample questions. DAST 2005 Q.We’ve seen that solving the shortest paths problem requires O(VE) time using the Belman-Ford.
External Memory Graph Algorithms and Applications to GIS Laura Toma Duke University July
Graphs G = (V,E) V is the vertex set. Vertices are also called nodes and points. E is the edge set. Each edge connects two different vertices. Edges are.
Connected Components, Directed graphs, Topological sort COMP171 Fall 2005.
External Memory Algorithms Kamesh Munagala. External Memory Model Aggrawal and Vitter, 1988.
More Graph Algorithms Weiss ch Exercise: MST idea from yesterday Alternative minimum spanning tree algorithm idea Idea: Look at smallest edge not.
External-Memory MST (Arge, Brodal, Toma). Minimum-Spanning Tree Given a weighted, undirected graph G=(V,E), the minimum-spanning tree (MST) problem is.
CSC 2300 Data Structures & Algorithms March 30, 2007 Chapter 9. Graph Algorithms.
David Luebke 1 8/7/2015 CS 332: Algorithms Graph Algorithms.
Review of Graphs A graph is composed of edges E and vertices V that link the nodes together. A graph G is often denoted G=(V,E) where V is the set of vertices.
Graphs – Shortest Path (Weighted Graph) ORD DFW SFO LAX
CISC 235: Topic 11 Shortest Paths Algorithms. CISC 235 Topic 112 Outline Single-Source Shortest Paths Algorithm for Unweighted Graphs Algorithm for Weighted,
1 Graphs Algorithms Sections 9.1, 9.2, and Graphs v1v1 v2v2 v5v5 v7v7 v8v8 v3v3 v6v6 v4v4 A graph G = (V, E) –V: set of vertices (nodes) –E: set.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
1 Chapter 9 Graph Algorithms Real-life graph problems Algorithms for some graph problems Choice of data structures for graph problems.
Dijkstras Algorithm Named after its discoverer, Dutch computer scientist Edsger Dijkstra, is an algorithm that solves the single-source shortest path problem.
I/O-Efficient Graph Algorithms Norbert Zeh Duke University EEF Summer School on Massive Data Sets Århus, Denmark June 26 – July 1, 2002.
A Survey of Techniques for Designing I/O-Efficient Algorithm S.Fahimeh Moosavi Fall 1389.
CS 3343: Analysis of Algorithms Lecture 21: Introduction to Graphs.
GRAPHS CSE, POSTECH. Chapter 16 covers the following topics Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component,
1 ELEC692 Fall 2004 Lecture 1b ELEC692 Lecture 1a Introduction to graph theory and algorithm.
Graph Algorithms. Definitions and Representation An undirected graph G is a pair (V,E), where V is a finite set of points called vertices and E is a finite.
Graphs. What is a graph? A data structure that consists of a set of nodes (vertices) and a set of edges that relate the nodes to each other The set of.
Introduction to Graphs. Introduction Graphs are a generalization of trees –Nodes or verticies –Edges or arcs Two kinds of graphs –Directed –Undirected.
MA/CSSE 473 Day 15 BFS Topological Sort Combinatorial Object Generation Intro.
Terracost: Hazel, Toma, Vahrenhold, Wickremesinghe Terracost: A Versatile and Scalable Approach to Computing Least-Cost-Path Surfaces for Massive Grid-Based.
Graphs. Definitions A graph is two sets. A graph is two sets. –A set of nodes or vertices V –A set of edges E Edges connect nodes. Edges connect nodes.
Data Structures & Algorithms Graphs
Lecture 11 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
Flow Algorithms Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Analysis of Algorithms Week 9, Lecture 2.
1 Chapter 22 Elementary Graph Algorithms. 2 Introduction G=(V, E) –V = vertex set –E = edge set Graph representation –Adjacency list –Adjacency matrix.
Efficient Algorithms for Large-Scale GIS Applications Laura Toma Duke University.
Data Structures & Algorithms Graphs Richard Newman based on book by R. Sedgewick and slides by S. Sahni.
GRAPHS. Graph Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component, spanning tree Types of graphs: undirected,
CSE 421 Algorithms Richard Anderson Winter 2009 Lecture 5.
Graphs and Shortest Paths Using ADTs and generic programming.
SSSP in DAGs (directed acyclic graphs). DFS (depth first search) DFS(vertex v) { v.visited = TRUE; for each w adjacent to v do if(!w.visited) then dfs(w);
External Memory Graph Algorithms and Applications to GIS Laura Toma Bowdoin College.
Lecture 20. Graphs and network models 1. Recap Binary search tree is a special binary tree which is designed to make the search of elements or keys in.
CSC317 1 At the same time: Breadth-first search tree: If node v is discovered after u then edge uv is added to the tree. We say that u is a predecessor.
1 Data Structures and Algorithms Graphs. 2 Graphs Basic Definitions Paths and Cycles Connectivity Other Properties Representation Examples of Graph Algorithms:
CS 202, Spring 2003 Fundamental Structures of Computer Science II Bilkent University1 Graph Algorithms CS 202 – Fundamental Structures of Computer Science.
CSE 2331/5331 Topic 9: Basic Graph Alg.
CS 3343: Analysis of Algorithms
Connected Components, Directed Graphs, Topological Sort
Graph Algorithms "A charlatan makes obscure what is clear; a thinker makes clear what is obscure. " - Hugh Kingsmill CLRS, Sections 22.2 – 22.4.
CSE 417: Algorithms and Computational Complexity
GRAPHS Lecture 17 CS2110 Spring 2018.
Presentation transcript:

Laura TomaSimplified External memory Algorithms for Planar DAGs Simplified External Memory Algorithms for Planar DAGs July 2004 Lars Arge Laura Toma Duke University Bowdoin College

Laura TomaSimplified External memory Algorithms for Planar DAGs Graph Problems Graph G = (V, E) with V vertices and E edges –DAG: directed acyclic graph –G is planar if it can be drawn in the plane so no edges cross Some fundamental problems: –BFS, DFS –Single-source shortest path (SSSP) –Topological order of a DAG A labeling of vertices such that if (v,u) in E then µ(v)< µ(u)

Laura TomaSimplified External memory Algorithms for Planar DAGs Massive graphs Massive planar graphs appear frequently in GIS –Terrains are stored as grids or triangulations –Example: modeling flow on terrain Each point is assigned a flow direction such that the resulting graph is directed and acyclic To trace the amount of flow must topologically sort this graph Massive graphs stored on disk –Assume edge-list representation stored on disk I/O can be severe bottleneck Adj(v1) Adj(v2) Adj(v3) … G

Laura TomaSimplified External memory Algorithms for Planar DAGs Parameters: N = V+E B = disk block size M = memory size I/O-operation: –movement of one block of data from/to disk Fundamental bounds: In practice B and M are big I/O Model [AV’88] M Block I/O Sorting: sort(N) = I/Os Scanning: scan(N) = I/Os

Laura TomaSimplified External memory Algorithms for Planar DAGs Previous Results Lower bound: (practically sort(V)) Not matched for most general graph problems, e.g. –General undirected graphs BFS: [MM’02] SSSP: [MZ’03] DFS: [KS’96] –General directed graphs BFS, DFS, SSSP, topological order (DAG) [BVWB’00] Sparse graphs E=O(V) – Directed BFS, DFS, SSSP: O(V) I/Os

Laura TomaSimplified External memory Algorithms for Planar DAGs Previous Results Improved algorithms for special classes of (sparse) graphs –Planar undirected graphs solved using O(sort(N)) reductions O(sort(N)) multi-way separation algorithm [MZ’02] –Generalized to planar directed graphs BFS, SSSP: O(sort(N)) [ATZ’03] DFS: O(sort(N) log N) [AZ’03] Planar DAG topological sort : O(sort(N)) [ATZ’03] –Computed using a DED of the dual graph Multi-way SSSP BFS DFS separation [ABT01 ] [AMTZ01 ]

Laura TomaSimplified External memory Algorithms for Planar DAGs Our Results Simplified algorithms for planar DAGs O(scan(N)) I/Os separation ============> top order, BFS, SSSP This does not improve the O(sort(N)) known upper bound since computing the separation takes O(sort(N)) I//Os Previous algorithms take O(sort(N)) even if separation is given

Laura TomaSimplified External memory Algorithms for Planar DAGs Planar graph separation: R-partition A partition of a planar graph using a set S of separator vertices into subgraphs (clusters) of at most R vertices each such that: separators vertices in total Each cluster is adjacent to separator vertices In external memory choose R = B 2 –O(N/B) separator vertices –O(N/B 2 ) clusters, O(B 2 ) vertices each and O(B) boundary vertices –Can be computed in O(sor(N)) I/Os [MZ’02] R R R R R R R R R

Laura TomaSimplified External memory Algorithms for Planar DAGs Planar SSSP 1. Compute a B 2 -partition of G 2. Construct a substitute graph G R on the separator vertices such that it preserves SP in G between any u,v in S –replace each subgraph G i with a complete graph on boundary of G i –for any u, v on boundary of G i, the weight of edge (u,v) is  Gi (u,v) 3. Solve SSSP on G R 4. Find SSSP to vertices inside clusters Computed efficiently using G R has O(N/B) vertices and O(N) edges Properties of the B 2 -partition s t B2B2

Laura TomaSimplified External memory Algorithms for Planar DAGs A Topological Sort Algorithm Compute indegree of each vertex Maintain list Z of indegree-zero vertices Repeatedly –Number an indegree-zero vertex v –Consider all edges (v,u) and decrement indegree of u –If indegree(u) becomes 0 insert u in list Z O(1) I/O per edge ==> O(N) I/Os v

Laura TomaSimplified External memory Algorithms for Planar DAGs Topological Sort using B 2 -partition 1. Construct a substitute graph G R using B 2 -partition –edge from v to u on boundary of G i iff exists path from v to u in G i Lemma: for any separator vertices u,v if u is reachable from v in G, then u is reachable from v in G R 2. Topologically sort G R (separator vertices in G) Lemma: A topological order on G R is a topological order on G. 3. Compute topological order inside clusters B2B2

Laura TomaSimplified External memory Algorithms for Planar DAGs Topological Sort using B 2 -partition Problem: –Not clear how to incorporate removed vertices from G in topological order of separator vertices (G R ) Solution (assuming only one in-degree zero vertex s for simplicity): –Longest-path-from-s order is a topological order –Longest paths to removed vertices locally computable from longest-paths to boundary vertices B F C D A E s t B2B2

Laura TomaSimplified External memory Algorithms for Planar DAGs Topological Sort using B 2 -partition 1. Construct substitute graph G R –Weight of edge between v and u on boundary of G i equal to length of longest path from v to u in G i 2. Topologically sort G R 3. Compute longest path to each vertex in G R (same as in G): –Maintain list L of longest paths seen to each vertex –Repeatedly: Obtain longest path for the next vertex v in topological order Consider all edges (v,u) and update longest path to u in L 4. Find longest path to vertices inside clusters v

Laura TomaSimplified External memory Algorithms for Planar DAGs Longest path to vertices inside a cluster must cross the boundary of the cluster LP(v) = max u  Bnd(Gi) {LP(u) + LP Gi (u,v)} v s GjGj α u

Laura TomaSimplified External memory Algorithms for Planar DAGs Analysis Topologically sort G R Maintain a list L with the indegree of each vertex Maintain list Z of indegree-zero vertices Repeatedly –Number an indegree-zero vertex v from Z –Consider all edges (v,u) and decrement indegree of u in L –If indegree(u) becomes 0 insert u in list Z G R has O(N/B) vertices and O(N/B 2 x B 2 ) = O(N) edges Each vertex: access its adjacency list ==> O(N/B) I/Os Each edge (v,u): update L ==> O(N) I/Os –Can be reduced to O(N/B) using boundary set property v

Laura TomaSimplified External memory Algorithms for Planar DAGs Analysis Boundary set in the B 2 -partition (Maximal) set of separator vertices adjacent to the same clusters –A boundary set is of size O(B) –There are O(N/B 2 ) boundary sets [F’87] (ass. bounded degree) We store L so that vertices in the same boundary set are consecutive –Vertices in same boundary set have same O(B) neighbors in G R –Each boundary set is accessed once by each neighbor in G R –Each boundary set has size O(B)  O(N/B 2 ) x O(B) = O(N/B) I/Os

Laura TomaSimplified External memory Algorithms for Planar DAGs Conclusion and Open Problems Given a B 2 -partition topological order can be computed in O(scan)N)) I/Os Longest path idea can also be used to compute SSSP and BFS in the same bound Open problems: –Improved DFS on DAGs? (exploiting acyclicity) Planar directed DFS O(sort(N) log N)

Laura TomaSimplified External memory Algorithms for Planar DAGs Analysis Compute longest path to each vertex in G R (same as in G): –Maintain list L’ of longest paths seen to each vertex –Repeatedly: Obtain longest path for next vertex v in topological order Consider all edges (v,u) and update longest path to u We store L’ so that vertices in the same boundary set are consecutive –Vertices in same boundary set have same O(B) neighbors in G R –Each boundary set is accessed once by each neighbor in G R –Each boundary set has size O(B)  O(N/B 2 ) x O(B) = O(N/B) I/Os v