Spanning Trees and Optimization Problems (Excerpt)

Similar documents
A Simple Shortest Path Algorithm with Linear Average Time

Algorithms for Shortest Paths. course web page: piazza: Learn - for marks. Lecture 1. CS 860 Fall Anna Lubiw, U. Waterloo.

Heap-on-Top Priority Queues. March Abstract. We introduce the heap-on-top (hot) priority queue data structure that combines the

Two-Levels-Greedy: a generalization of Dijkstra s shortest path algorithm

An Algorithm and Evaluations of Real Time Shortest Path according to current traffic on road

Computer Science & Engineering 423/823 Design and Analysis of Algorithms

Single Source Shortest Path

Buckets, Heaps, Lists, and. Monotone Priority Queues. Craig Silverstein y. Computer Science Department. Stanford University. Stanford, CA 94305

ARTICLE IN PRESS. JID:JDA AID:300 /FLA [m3g; v 1.81; Prn:3/04/2009; 15:31] P.1 (1-10) Journal of Discrete Algorithms ( )

Single Source Shortest Paths

Expected Time in Linear Space

Shortest Path Problem

Single Source Shortest Path (SSSP) Problem

On the Bottleneck Shortest Path Problem

An Improved Thorup Shortest Paths Algorithm with a Modified Component Tree

Introduction to Algorithms Third Edition

2. True or false: even though BFS and DFS have the same space complexity, they do not always have the same worst case asymptotic time complexity.

22 Elementary Graph Algorithms. There are two standard ways to represent a

Two-Level Heaps: A New Priority Queue Structure with Applications to the Single Source Shortest Path Problem

Lecture 11: Analysis of Algorithms (CS ) 1

CS420/520 Algorithm Analysis Spring 2009 Lecture 14

Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest. Introduction to Algorithms

Spanning Trees and Optimization Problems

Minimum Spanning Trees

Graphs. Part II: SP and MST. Laura Toma Algorithms (csci2200), Bowdoin College

Average-case complexity of single-source shortest-paths algorithms: lower and upper bounds

CS350: Data Structures Dijkstra s Shortest Path Alg.

Introduction Single-source shortest paths All-pairs shortest paths. Shortest paths in graphs

Single-Source Shortest Paths. CSE 2320 Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington

Minimum Cost Edge Disjoint Paths

COMP251: Single source shortest paths

Unit 2: Algorithmic Graph Theory

TIE Graph algorithms

Chapter 24. Shortest path problems. Chapter 24. Shortest path problems. 24. Various shortest path problems. Chapter 24. Shortest path problems

Self Centered and Almost self centered graphs

4/8/11. Single-Source Shortest Path. Shortest Paths. Shortest Paths. Chapter 24

8.1 Introduction. Background: Breadth First Search. CS125 Lecture 8 Fall 2014

A Faster Algorithm for the Single Source Shortest Path Problem with Few Distinct Positive Lengths

Analysis of Algorithms

Directed Single Source Shortest Paths in Linear Average Case Time

A Study of Different Parallel Implementations of Single Source Shortest Path Algorithms

CS 341: Algorithms. Douglas R. Stinson. David R. Cheriton School of Computer Science University of Waterloo. February 26, 2019

Reducing Directed Max Flow to Undirected Max Flow and Bipartite Matching

A Primal-Dual Approximation Algorithm for Partial Vertex Cover: Making Educated Guesses

arxiv: v2 [cs.dm] 28 Dec 2010

Single source shortest paths in H-minor free graphs

Scribe from 2014/2015: Jessica Su, Hieu Pham Date: October 6, 2016 Editor: Jimmy Wu

Outline. Computer Science 331. Definitions: Paths and Their Costs. Computation of Minimum Cost Paths

An Extended Shortest Path Problem with Switch Cost Between Arcs

6.006 Introduction to Algorithms Spring 2008

An O(n 2.75 ) algorithm for online topological ordering 1

Breadth-First Search, 1. Slides for CIS 675 DPV Chapter 4. Breadth-First Search, 3. Breadth-First Search, 2

CSC 373 Lecture # 3 Instructor: Milad Eftekhar

Implementations of Dijkstra's Algorithm. Based on Multi-Level Buckets. November Abstract

Dijkstra s Shortest Path Algorithm

Algorithm Design (8) Graph Algorithms 1/2

from notes written mostly by Dr. Carla Savage: All Rights Reserved

All-Pairs Nearly 2-Approximate Shortest-Paths in O(n 2 polylog n) Time

Dijkstra s Algorithm. Dijkstra s algorithm is a natural, greedy approach towards

A 4-Approximation Algorithm for k-prize Collecting Steiner Tree Problems

Detecting negative cycles with Tarjan s breadth-first scanning algorithm

Introductory Computer Programming: Shortest Path Algorithms

Introduction to Algorithms. Lecture 11

Weighted Graph Algorithms Presented by Jason Yuan

Generalization of Dijkstra s Algorithm for Extraction of Shortest Paths in Directed Multigraphs

Algorithms on Graphs: Part III. Shortest Path Problems. .. Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar..

Objective of the present work

22 Elementary Graph Algorithms. There are two standard ways to represent a

Algorithm Analysis Graph algorithm. Chung-Ang University, Jaesung Lee

Dijkstra s Algorithm Last time we saw two methods to solve the all-pairs shortest path problem: Min-plus matrix powering in O(n 3 log n) time and the

Lecture 1. Introduction

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

Introduction. I Given a weighted, directed graph G =(V, E) with weight function

Parametric Maximum Flow Problem: Techniques and Algorithms. Deepika Sareen, Dr Deepak Garg. Thapar University, Patiala

Smoothed Analysis of the Minimum-Mean Cycle Canceling Algorithm and the Network Simplex Algorithm

Minimum-Spanning-Tree problem. Minimum Spanning Trees (Forests) Minimum-Spanning-Tree problem

Advanced Algorithms and Data Structures

CONSTRUCTION AND EVALUATION OF MESHES BASED ON SHORTEST PATH TREE VS. STEINER TREE FOR MULTICAST ROUTING IN MOBILE AD HOC NETWORKS

Algorithms and Theory of Computation. Lecture 7: Priority Queue

A Parallel Genetic Algorithm for Maximum Flow Problem

CS 270 Algorithms. Oliver Kullmann. Breadth-first search. Analysing BFS. Depth-first. search. Analysing DFS. Dags and topological sorting.

15.082J & 6.855J & ESD.78J. Shortest Paths 2: Bucket implementations of Dijkstra s Algorithm R-Heaps

CS 161 Lecture 11 BFS, Dijkstra s algorithm Jessica Su (some parts copied from CLRS) 1 Review

COT 6405 Introduction to Theory of Algorithms

The Shortest Path Problem. The Shortest Path Problem. Mathematical Model. Integer Programming Formulation

Point-to-Point Shortest Path Algorithms with Preprocessing

Introduction. I Given a weighted, directed graph G =(V, E) with weight function

CS 561, Lecture 10. Jared Saia University of New Mexico

Melding priority queues

Design and Analysis of Algorithms

Shortest path problems

Chapter 22. Elementary Graph Algorithms

Clearly there is a close relation between the radius R and the diameter D of a graph, such as R D 2R.

Solutions for the Exam 6 January 2014

CS 561, Lecture 10. Jared Saia University of New Mexico

1 Introduction. 2 The Generic Push-Relabel Algorithm. Improvements on the Push-Relabel Method: Excess Scaling. 2.1 Definitions CMSC 29700

Interval Stabbing Problems in Small Integer Ranges

is the Capacitated Minimum Spanning Tree

Outline. (single-source) shortest path. (all-pairs) shortest path. minimum spanning tree. Dijkstra (Section 4.4) Bellman-Ford (Section 4.

Shortest Path Algorithms

Transcription:

Bang Ye Wu and Kun-Mao Chao Spanning Trees and Optimization Problems (Excerpt) CRC PRESS Boca Raton London New York Washington, D.C.

Chapter 3 Shortest-Paths Trees Consider a connected, undirected network with one special node, called the source (or root). Associated with each edge is a distance, a nonnegative number. The objective is to find the set of edges connecting all nodes such that the sum of the edge lengths from the source to each node is minimized. We call it a shortest-paths tree (SPT) rooted at the source. Shortest-paths trees are not necessarily unique. Figure 3.1 gives two shortestpaths trees rooted at vertex a. FIGURE 3.1: A shortest-paths tree rooted at vertex a. Consider the graph in Figure 3.2. In this chapter, the terms edge and arc are used interchangeably. We discuss two well-known algorithms for constructing a shortest-paths tree: Dijkstra s algorithm and the Bellman-Ford algorithm. Dijkstra s algorithm assumes that all edge weights in the graph are nonnegative, whereas the Bellman-Ford algorithm allows negative-weight edges in the graph. If there is no negative-weight cycle, the Bellman-Ford algorithm produces the shortest paths and their weights. Otherwise, the algorithm detects the negative cycles and indicates that no solution exists. Algorithm: Dijkstra iii

iv Spanning Trees and Optimization Problems (Excerpt) Input: A weighted, directed graph G = (V, E, w); a source vertex s. Output: A shortest-paths spanning tree T rooted at s. for each vertex v V do δ[v] π[v] NIL δ[s] 0 T S V while S do Choose u S with minimum δ[u] S S {u} if u s then T T {(π[u], u)} for each vertex v adjacent to u do if δ[v] > δ[u] + w(u, v) then δ[v] δ[u] + w(u, v) π[v] u Consider the graph in Figure 3.3. Figure 3.4. Figure 3.5. Figure 3.6. Figure 3.7. Figure 3.8. Figure 3.9. Figure 3.10. Figure 3.11. Figure 3.12 gives the shortest-paths tree constructed by Dijkstra s algorithm. Figure 3.13 gives an example of a directed graph with negative-weight edges for which Dijkstra s algorithm produces an incorrect answer. FIGURE 3.2: An undirected graph with a negative-weight edge.

Shortest-Paths Trees v FIGURE 3.3: A weighted, directed graph. FIGURE 3.4: Vertex a is chosen, and edges (a, b) and (a, g) are relaxed. FIGURE 3.5: Vertex b is chosen, and edges (b, c) and (b, d) are relaxed. Edge (a, b) is added to the shortest-paths tree.

vi Spanning Trees and Optimization Problems (Excerpt) FIGURE 3.6: Vertex g is chosen, and edges (g, e) and (g, h) are relaxed. Edge (a, g) is added to the shortest-paths tree. FIGURE 3.7: Vertex d is chosen, and edge (d, e) is relaxed. Edge (b, d) is added to the shortest-paths tree. FIGURE 3.8: tree. Vertex h is chosen. Edge (g, h) is added to the shortest-paths

Shortest-Paths Trees vii FIGURE 3.9: Vertex e is chosen, and edge (e, f) is relaxed. Edge (d, e) is added to the shortest-paths tree. FIGURE 3.10: Vertex c is chosen, and edge (c, h) is relaxed. Edge (b, c) is added to the shortest-paths tree. FIGURE 3.11: Vertex f is chosen, and edges (f, d) and (f, h) are relaxed. Edge (e, f) is added to the shortest-paths tree.

viii Spanning Trees and Optimization Problems (Excerpt) FIGURE 3.12: A shortest-paths tree constructed by Dijkstra s algorithm for the graph in Figure 3.3. FIGURE 3.13: A weighted, directed graph with a negative-weight edge.

Shortest-Paths Trees ix FIGURE 3.14: A failure of Dijkstra s algorithm. FIGURE 3.15: A wrong shortest-paths tree. As Dijkstra s algorithm proceeds on the graph in Figure 3.13, it will reach the status shown in Figure 3.14. The graph in Figure 3.15 is a wrong shortest-path tree produced by Dijkstra s algorithm. A correct shortest-paths tree is given in Figure 3.16. Algorithm: Bellman-Ford Input: A weighted, directed graph G = (V, E, w); a source vertex s. Output: A shortest-paths spanning tree T rooted at s. for each vertex v V do δ[v] π[v] NIL δ[s] 0 for i 0 to n 1 do for each (u, v) E do if δ[v] > δ[u] + w(u, v) then δ[v] δ[u] + w(u, v)

x Spanning Trees and Optimization Problems (Excerpt) FIGURE 3.16: A correct shortest-paths tree. π[v] u for each (u, v) E do if δ[v] > δ[u] + w(u, v) then Output A negative cycle exists. Exit T for v V s do T T {(π[v], v)} Figure 3.17. Figure 3.18. Figure 3.19. Figure 3.20. Figure 3.21. FIGURE 3.17: Shortest-path estimates δ[b] and δ[g] are modified.

Shortest-Paths Trees xi Shortest-path estimates δ[c], δ[d], δ[e], and δ[h] are modi- FIGURE 3.18: fied. FIGURE 3.19: Shortest-path estimate δ[f] is modified. FIGURE 3.20: Shortest-path estimate δ[h] is modified.

xii Spanning Trees and Optimization Problems (Excerpt) FIGURE 3.21: algorithm. The shortest-paths tree constructed by the Bellman-Ford Bibliographic Notes and Further Reading The shortest-paths tree problem is one of the most classical network flow optimization problems. An equivalent problem is to find a shortest path from a given source vertex s V to every vertex v V. Algorithms for this problem have been studied for a long time. In fact, since the end of the 1950s, thousands of scientific works have been published. A good description of the classical algorithms and their implementations can be found in [2, 8]. Dijkstra s original algorithm, by Edsger W. Dijkstra [5], did not mention the usage of a priority queue. A discussion of using different priority queue techniques can be found in [2, 3]. For the shortest path problem with nonnegative arc lengths, the Fibonacci heap data structure [7] yields an O(m + n log n) implementation of Dijkstra s algorithm in the pointer model of computation. Let U denote the biggest arc length, and C be the ratio between U and the smallest nonzero arc length. In a RAM model with word operations, the fastest known algorithms achieve the following bounds: O(m + n( log n) [12], O(m + n(log C log log C) 1/3 ) [9, 13], O(m log log U) [10], and O(m log log n) [15]. Ulrich Meyer [11] shows the problem can be solved in linear average time if input arc lengths are independent and uniformly distributed. Andrew V. Goldberg [9] shows that a simple modification of the algorithm of [4] yields an algorithm with linear average running time on the uniform arc length distribution. For undirected graphs, Mikkel Thorup [14] gave a linear-time algorithm in a word RAM model. The Bellman-Ford algorithm is based on separate algorithms by Richard Bellman [1], and Lestor Ford, Jr. and D.R. Fulkerson [6]. Though the Bellman-Ford algorithm is simple and has a high running time, to date there

Shortest-Paths Trees xiii is no algorithm which significantly improves its asymptotic complexity.

References [1] R. Bellman. On a routing problem. Quar. Appl. Math., 16:87 90, 1958. [2] B.V. Cherkassky, A.V. Goldberg, and T. Radzik. Shortest paths algorithms: theory and experimental evaluation. In Proceedings of the Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 516 525, 1994. [3] T.H. Cormen, C.E. Leiserson, and R.L. Rivest. Introduction to Algorithms. The MIT Press, 1994. [4] E.V. Denardo and B.L. Fox. Shortest-route methods: 1. reaching, pruning, and buckets. Oper. Res., 27:161 186, 1979. [5] E.W. Dijkstra. A note on two problems in connection with graphs. Numer. Math., 1:269 271, 1959. [6] L.R. Ford, Jr. and D.R. Fulkerson. Flows in Networks. Princeton University Press, 1962. [7] M.L. Fredman and R.E. Tarjan. Fibonacci heaps and their uses in improved network optimization algorithms. J. ACM, 34:596 615, 1987. [8] G. Gallo and S. Pallottino. Shortest paths algorithms. Ann. Oper. Res., 13:3 79. [9] A.V. Goldberg. A simple shortest path algorithm with linear average time. In Proceedings of the 9th Annual European Symposium Algorithms, pages 230 241, 2001. [10] T. Hagerup. Improved shortest paths in the word RAM. In Proceedings of the 27th International Colloquium on Automata, Languages and Programming, pages 61 72, 2000. [11] U. Meyer. Single-source shortest paths on arbitrary directed graphs inlinear average time. In Proceedings of the 12th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 797 806, 2001. [12] R. Raman. Priority queues: small, monotone and trans-dichotomous. In Proceedings of the 4th Annual European Symposium Algorithms, pages 121 137, 1996. [13] R. Raman. Recent results on single-source shortest paths problem. SIGACT News, 28:81 87, 1997. xv

xvi References [14] M. Thorup. Undirected single-source shortest paths with positive integer weights in linear time. J. ACM, 46:362 394, 1999. [15] M. Thorup. On RAM priority queues. SIAM J. Comput., 30:86 109, 2000.