ECE250: Algorithms and Data Structures Single Source Shortest Paths Dijkstra s Algorithm

Size: px
Start display at page:

Download "ECE250: Algorithms and Data Structures Single Source Shortest Paths Dijkstra s Algorithm"

Transcription

1 ECE0: Algorithms and Data Strctres Single Sorce Shortest Paths Dijkstra s Algorithm Ladan Tahildari, PEng, SMIEEE Associate Professor Software Technologies Applied Research (STAR) Grop Dept. of Elect. & Comp. Eng. Uniersity of Waterloo Materials from CLRS: Chapter 4.3, pp

2 Acknowledgements The following resorces hae been sed to prepare materials for this corse: Ø MIT OpenCorseWare Ø Introdction To Algorithms (CLRS Book) Ø Data Strctres and Algorithm Analysis in C++ (M. Wiess) Ø Data Strctres and Algorithms in C++ (M. Goodrich) Thanks to many people for pointing ot mistakes, proiding sggestions, or helping to improe the qality of this corse oer the last ten years: Ø ECE0

3 Shortest Path Generalize distance to weighted setting Digraph G = (V,E) with weight fnction W: E R (assigning real ales to edges) Weight of path p = 1 k is k 1 wp ( ) = w ( i, i+ 1) i= 1 Shortest path = a path of the minimm weight Applications Ø static/dynamic network roting Ø robot motion planning Ø map/rote generation in traffic ECE0 3

4 Shortest-Path Problems Single-sorce (single-destination). Find a shortest path from a gien sorce (ertex s) to each of the ertices. The topic of this lectre. Single-pair. Gien two ertices, find a shortest path between them. Soltion to single-sorce problem soles this problem efficiently, too. All-pairs. Find shortest-paths for eery pair of ertices. Dynamic programming algorithm. Unweighted shortest-paths Ø BFS ECE0 4

5 Optimal Sbstrctre Theorem: Sbpaths of shortest paths are shortest paths Proof ( ct and paste ) Ø if some sbpath were not the shortest path, one cold sbstitte the shorter sbpath and create a shorter total path ECE0

6 Negatie Weights and Cycles? Negatie edges are OK, as long as there are no negatie weight cycles (otherwise paths with arbitrary small lengths wold be possible) Shortest-paths can hae no cycles (otherwise we cold improe them by remoing cycles) Ø Any shortest-path in graph G can be no longer than n 1 edges, where n is the nmber of ertices ECE0 6

7 Shortest Path Tree The reslt of the algorithms a shortest path tree. For each ertex, it Ø records a shortest path from the start ertex s to..parent() gies a predecessor of in this shortest path Ø gies a shortest path length from s to, which is recorded in.d(). Vertex ADT with operations: Ø adjacent():vertexset Ø keyd():int and setd(k:int) Ø parent():vertex and setparent(p:vertex) ECE0 7

8 Relaxation For each ertex in the graph, we maintain.d(), the estimate of the shortest path from s, initialized to at the start Relaxing an edge (,) means testing whether we can improe the shortest path to fond so far by going throgh 9 Relax(,) 7 6 Relax(,) 6 Relax (,,G) if.d() >.d()+g.w(,) then.setd(.d()+g.w(,)).setparent() ECE0 8

9 Dijkstra's Algorithm Non-negatie edge weights Greedy, similar to Prim's algorithm for MST Like breadth-first search (if all weights = 1, one can simply se BFS) Use Q, a priority qee ADT keyed by.d() (BFS sed FIFO qee, here we se a PQ, which is reorganized wheneer some d decreases) Basic idea Ø maintain a set S of soled ertices Ø at each step select "closest" ertex, add it to S, and relax all edges from ECE0 9

10 Dijkstra s Psedo Code Dijkstra(G,s) 01 for each ertex G.V() 0.setd( ) 03.setparent(NIL) 04 s.setd(0) 0 S // Set S is sed to explain the algorithm 06 Q.init(G.V()) // Q is a priority qee ADT 07 while not Q.isEmpty() 08 Q.extractMin() 09 S S {} 10 for each.adjacent() do 11 Relax(,, G) 1 Q.modifyKey() relaxing edges ECE0 10

11 Dijkstra s Example Dijkstra(G,s) 01 for each ertex G.V() 0.setd( ) 03.setparent(NIL) s 04 s.setd(0) 0 S 06 Q.init(G.V()) 07 while not Q.isEmpty() 08 Q.extractMin() 09 S S {} 10 for each.adjacent() do 11 Relax(,, G) 1 Q.modifyKey() s ECE x y 10 3 x y

12 Dijkstra s Example (cont ) Dijkstra(G,s) 01 for each ertex G.V() 0.setd( ) 03.setparent(NIL) s 04 s.setd(0) 0 S 06 Q.init(G.V()) 07 while not Q.isEmpty() 08 Q.extractMin() 09 S S {} 10 for each.adjacent() do 11 Relax(,, G) 1 Q.modifyKey() s ECE x y x y

13 Dijkstra s Example (cont ) Dijkstra(G,s) 01 for each ertex G.V() 0.setd( ) s 03.setparent(NIL) 04 s.setd(0) 0 S 06 Q.init(G.V()) 07 while not Q.isEmpty() 08 Q.extractMin() 09 S S {} 10 for each.adjacent() do 11 Relax(,, G) 1 Q.modifyKey() s ECE x y x y

14 Dijkstra s Psedo Code Dijkstra(G,s) 01 for each ertex G.V() 0.setd( ) 03.setparent(NIL) 04 s.setd(0) 0 S // Set S is sed to explain the algorithm 06 Q.init(G.V()) // Q is a priority qee ADT 07 while not Q.isEmpty() 08 Q.extractMin() 09 S S {} 10 for each.adjacent() do 11 Relax(,, G) 1 Q.modifyKey() relaxing edges ECE0 14

15 Dijkstra s Rnning Time Extract-Min exected V time Decrease-Key exected E time Time = V T extractmin + E T modifykey T depends on different PQ implementations Q T(extractMin) T(modifyKey) Total array Ο(V) Ο(1) Ο(V ) binary heap Ο(lg V) Ο(lg V) Ο(E lg V) ECE0 1

ECE250: Algorithms and Data Structures Single Source Shortest Paths Bellman-Ford Algorithm

ECE250: Algorithms and Data Structures Single Source Shortest Paths Bellman-Ford Algorithm ECE250: Algorithms and Data Structures Single Source Shortest Paths Bellman-Ford Algorithm Ladan Tahvildari, PEng, SMIEEE Associate Professor Software Technologies Applied Research (STAR) Group Dept. of

More information

ECE250: Algorithms and Data Structures Elementary Graph Algorithms Part A

ECE250: Algorithms and Data Structures Elementary Graph Algorithms Part A ECE250: Algorithms and Data Structures Elementary Graph Algorithms Part A Ladan Tahvildari, PEng, SMIEEE Associate Professor Software Technologies Applied Research (STAR) Group Dept. of Elect. & Comp.

More information

CS 557 Lecture IX. Drexel University Dept. of Computer Science

CS 557 Lecture IX. Drexel University Dept. of Computer Science CS 7 Lectre IX Dreel Uniersity Dept. of Compter Science Fall 00 Shortest Paths Finding the Shortest Paths in a graph arises in many different application: Transportation Problems: Finding the cheapest

More information

Page 1. CSCE 310J Data Structures & Algorithms. CSCE 310J Data Structures & Algorithms. Greedy Algorithms and Graph Optimization Problems

Page 1. CSCE 310J Data Structures & Algorithms. CSCE 310J Data Structures & Algorithms. Greedy Algorithms and Graph Optimization Problems CSCE J Data Strctres & Algorithms Greedy Algorithms and Graph Optimization Problems Dr. Steve Goddard goddard@cse.nl.ed http://www.cse.nl.ed/~goddard/corses/cscej CSCE J Data Strctres & Algorithms Giving

More information

Shortest path problems

Shortest path problems Next... Shortest path problems Single-source shortest paths in weighted graphs Shortest-Path Problems Properties of Shortest Paths, Relaxation Dijkstra s Algorithm Bellman-Ford Algorithm Shortest-Paths

More information

ECE250: Algorithms and Data Structures Elementary Graph Algorithms Part B

ECE250: Algorithms and Data Structures Elementary Graph Algorithms Part B ECE250: Algorithms and Data Structures Elementary Graph Algorithms Part B Ladan Tahvildari, PEng, SMIEEE Associate Professor Software Technologies Applied Research (STAR) Group Dept. of Elect. & Comp.

More information

Minimum Spanning Trees Outline: MST

Minimum Spanning Trees Outline: MST Minimm Spanning Trees Otline: MST Minimm Spanning Tree Generic MST Algorithm Krskal s Algorithm (Edge Based) Prim s Algorithm (Vertex Based) Spanning Tree A spanning tree of G is a sbgraph which is tree

More information

Path Planning in Partially-Known Environments. Prof. Brian Williams (help from Ihsiang Shu) /6.834 Cognitive Robotics February 17 th, 2004

Path Planning in Partially-Known Environments. Prof. Brian Williams (help from Ihsiang Shu) /6.834 Cognitive Robotics February 17 th, 2004 Path Planning in Partially-Known Enironments Prof. Brian Williams (help from Ihsiang Sh) 16.41/6.834 Cognitie Robotics Febrary 17 th, 004 Otline Path Planning in Partially Known Enironments. Finding the

More information

ECE250: Algorithms and Data Structures Binary Search Trees (Part A)

ECE250: Algorithms and Data Structures Binary Search Trees (Part A) ECE250: Algorithms and Data Structures Binary Search Trees (Part A) Ladan Tahvildari, PEng, SMIEEE Associate Professor Software Technologies Applied Research (STAR) Group Dept. of Elect. & Comp. Eng. University

More information

ECE250: Algorithms and Data Structures AVL Trees (Part A)

ECE250: Algorithms and Data Structures AVL Trees (Part A) ECE250: Algorithms and Data Structures AVL Trees (Part A) Ladan Tahvildari, PEng, SMIEEE Associate Professor Software Technologies Applied Research (STAR) Group Dept. of Elect. & Comp. Eng. University

More information

Partha Sarathi Mandal

Partha Sarathi Mandal MA 5: Data Strctres and Algorithms Lectre http://www.iitg.ernet.in/psm/indexing_ma5/y1/index.html Partha Sarathi Mandal Dept. of Mathematics, IIT Gwahati Idea of Prim s Algorithm Instead of growing the

More information

ECE250: Algorithms and Data Structures Final Review Course

ECE250: Algorithms and Data Structures Final Review Course ECE250: Algorithms and Data Structures Final Review Course Ladan Tahvildari, PEng, SMIEEE Professor Software Technologies Applied Research (STAR) Group Dept. of Elect. & Comp. Eng. University of Waterloo

More information

Data Structures and Algorithms. Werner Nutt

Data Structures and Algorithms. Werner Nutt Data Structures and Algorithms Werner Nutt nutt@inf.unibz.it http://www.inf.unibz/it/~nutt Chapter 10 Academic Year 2012-2013 1 Acknowledgements & Copyright Notice These slides are built on top of slides

More information

Introduction to Algorithms. Lecture 11

Introduction to Algorithms. Lecture 11 Introduction to Algorithms Lecture 11 Last Time Optimization Problems Greedy Algorithms Graph Representation & Algorithms Minimum Spanning Tree Prim s Algorithm Kruskal s Algorithm 2 Today s Topics Shortest

More information

Chapter 4: Network Layer

Chapter 4: Network Layer Chapter 4: Introdction (forarding and roting) Reie of qeeing theor Roting algorithms Link state, Distance Vector Roter design and operation IP: Internet Protocol IP4 (datagram format, addressing, ICMP,

More information

Introduction to Algorithms. Minimum Spanning Tree. Chapter 23: Minimum Spanning Trees

Introduction to Algorithms. Minimum Spanning Tree. Chapter 23: Minimum Spanning Trees Introdction to lgorithms oncrete example Imagine: Yo wish to connect all the compters in an office bilding sing the least amont of cable - ach vertex in a graph G represents a compter - ach edge represents

More information

ECE250: Algorithms and Data Structures B-Trees (Part A)

ECE250: Algorithms and Data Structures B-Trees (Part A) ECE250: Algorithms and Data Structures B-Trees (Part A) Ladan Tahvildari, PEng, SMIEEE Associate Professor Software Technologies Applied Research (STAR) Group Dept. of Elect. & Comp. Eng. University of

More information

Discrete Math For Computing II

Discrete Math For Computing II Discrete Math For Computing II Main Text: Topics in enumeration; principle of inclusion and exclusion, Partial orders and lattices. Algorithmic complexity; recurrence relations, Graph theory. Prerequisite:

More information

Chapter 5 Network Layer

Chapter 5 Network Layer Chapter Network Layer Network layer Physical layer: moe bit seqence between two adjacent nodes Data link: reliable transmission between two adjacent nodes Network: gides packets from the sorce to destination,

More information

ECE250: Algorithms and Data Structures Dynamic Programming Part B

ECE250: Algorithms and Data Structures Dynamic Programming Part B ECE250: Algorithms and Data Structures Dynamic Programming Part B Ladan Tahvildari, PEng, SMIEEE Associate Professor Software Technologies Applied Research (STAR) Group Dept. of Elect. & Comp. Eng. University

More information

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

4/8/11. Single-Source Shortest Path. Shortest Paths. Shortest Paths. Chapter 24 /8/11 Single-Source Shortest Path Chapter 1 Shortest Paths Finding the shortest path between two nodes comes up in many applications o Transportation problems o Motion planning o Communication problems

More information

COT 6405 Introduction to Theory of Algorithms

COT 6405 Introduction to Theory of Algorithms COT 6405 Introduction to Theory of Algorithms Topic 16. Single source shortest path 11/18/2015 1 Problem definition Problem: given a weighted directed graph G, find the minimum-weight path from a given

More information

Lemma 1 Let the components of, Suppose. Trees. A tree is a graph which is. (a) Connected and. (b) has no cycles (acyclic). (b)

Lemma 1 Let the components of, Suppose. Trees. A tree is a graph which is. (a) Connected and. (b) has no cycles (acyclic). (b) Trees Lemma Let the components of ppose "! be (a) $&%('*)+ - )+ / A tree is a graph which is (b) 0 %(')+ - 3)+ / 6 (a) (a) Connected and (b) has no cycles (acyclic) (b) roof Eery path 8 in which is not

More information

5.4 Shortest Paths. Jacobs University Visualization and Computer Graphics Lab. CH : Algorithms and Data Structures 456

5.4 Shortest Paths. Jacobs University Visualization and Computer Graphics Lab. CH : Algorithms and Data Structures 456 5.4 Shortest Paths CH08-320201: Algorithms and Data Structures 456 Definitions: Path Consider a directed graph G=(V,E), where each edge e є E is assigned a non-negative weight w: E -> R +. A path is a

More information

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

Chapter 24. Shortest path problems. Chapter 24. Shortest path problems. 24. Various shortest path problems. Chapter 24. Shortest path problems Chapter 24. Shortest path problems We are given a directed graph G = (V,E) with each directed edge (u,v) E having a weight, also called a length, w(u,v) that may or may not be negative. A shortest path

More information

Maximal Cliques in Unit Disk Graphs: Polynomial Approximation

Maximal Cliques in Unit Disk Graphs: Polynomial Approximation Maximal Cliqes in Unit Disk Graphs: Polynomial Approximation Rajarshi Gpta, Jean Walrand, Oliier Goldschmidt 2 Department of Electrical Engineering and Compter Science Uniersity of California, Berkeley,

More information

COMP251: Single source shortest paths

COMP251: Single source shortest paths COMP51: Single source shortest paths Jérôme Waldispühl School of Computer Science McGill University Based on (Cormen et al., 00) Problem What is the shortest road to go from one city to another? Eample:

More information

ECE250: Algorithms and Data Structures Midterm Review

ECE250: Algorithms and Data Structures Midterm Review ECE250: Algorithms and Data Structures Midterm Review Ladan Tahvildari, PEng, SMIEEE Associate Professor Software Technologies Applied Research (STAR) Group Dept. of Elect. & Comp. Eng. University of Waterloo

More information

Varying Applications (examples)

Varying Applications (examples) Graph Theory Varying Applications (examples) Computer networks Distinguish between two chemical compounds with the same molecular formula but different structures Solve shortest path problems between cities

More information

Minimum Spanning Trees Ch 23 Traversing graphs

Minimum Spanning Trees Ch 23 Traversing graphs Next: Graph Algorithms Graphs Ch 22 Graph representations adjacency list adjacency matrix Minimum Spanning Trees Ch 23 Traversing graphs Breadth-First Search Depth-First Search 11/30/17 CSE 3101 1 Graphs

More information

Taking Stock. IE170: Algorithms in Systems Engineering: Lecture 20. Example. Shortest Paths Definitions

Taking Stock. IE170: Algorithms in Systems Engineering: Lecture 20. Example. Shortest Paths Definitions Taking Stock IE170: Algorithms in Systems Engineering: Lecture 20 Jeff Linderoth Department of Industrial and Systems Engineering Lehigh University March 19, 2007 Last Time Minimum Spanning Trees Strongly

More information

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

Algorithm Analysis Graph algorithm. Chung-Ang University, Jaesung Lee Algorithm Analysis Graph algorithm Chung-Ang University, Jaesung Lee Basic definitions Graph = (, ) where is a set of vertices and is a set of edges Directed graph = where consists of ordered pairs

More information

Dijkstra s Shortest Path Algorithm

Dijkstra s Shortest Path Algorithm Dijkstra s Shortest Path Algorithm DPV 4.4, CLRS 24.3 Revised, October 23, 2014 Outline of this Lecture Recalling the BFS solution of the shortest path problem for unweighted (di)graphs. The shortest path

More information

Greedy Algorithms. At each step in the algorithm, one of several choices can be made.

Greedy Algorithms. At each step in the algorithm, one of several choices can be made. Greedy Algorithms At each step in the algorithm, one of several choices can be made. Greedy Strategy: make the choice that is the best at the moment. After making a choice, we are left with one subproblem

More information

CSE 502 Class 23. Jeremy Buhler Steve Cole. April BFS solves unweighted shortest path problem. Every edge traversed adds one to path length

CSE 502 Class 23. Jeremy Buhler Steve Cole. April BFS solves unweighted shortest path problem. Every edge traversed adds one to path length CSE 502 Class 23 Jeremy Buhler Steve Cole April 14 2015 1 Weighted Version of Shortest Paths BFS solves unweighted shortest path problem Every edge traversed adds one to path length What if edges have

More information

C Puzzles The course that gives CMU its Zip! Integer Arithmetic Operations Jan. 25, Unsigned Addition. Visualizing Integer Addition

C Puzzles The course that gives CMU its Zip! Integer Arithmetic Operations Jan. 25, Unsigned Addition. Visualizing Integer Addition 1513 The corse that gies CMU its Zip! Integer Arithmetic Operations Jan. 5, 1 Topics Basic operations Addition, negation, mltiplication Programming Implications Conseqences of oerflow Using shifts to perform

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 6 Greedy Graph Algorithms Shortest paths Adam Smith 9/8/14 The (Algorithm) Design Process 1. Work out the answer for some examples. Look for a general principle Does

More information

Pipelined van Emde Boas Tree: Algorithms, Analysis, and Applications

Pipelined van Emde Boas Tree: Algorithms, Analysis, and Applications This fll text paper was peer reviewed at the direction of IEEE Commnications Society sbject matter experts for pblication in the IEEE INFOCOM 007 proceedings Pipelined van Emde Boas Tree: Algorithms, Analysis,

More information

Finite Domain Cuts for Minimum Bandwidth

Finite Domain Cuts for Minimum Bandwidth Finite Domain Cts for Minimm Bandwidth J. N. Hooker Carnegie Mellon University, USA Joint work with Alexandre Friere, Cid de Soza State University of Campinas, Brazil INFORMS 2013 Two Related Problems

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 7 Greedy Graph Algorithms Topological sort Shortest paths Adam Smith The (Algorithm) Design Process 1. Work out the answer for some examples. Look for a general principle

More information

Week 12: Minimum Spanning trees and Shortest Paths

Week 12: Minimum Spanning trees and Shortest Paths Agenda: Week 12: Minimum Spanning trees and Shortest Paths Kruskal s Algorithm Single-source shortest paths Dijkstra s algorithm for non-negatively weighted case Reading: Textbook : 61-7, 80-87, 9-601

More information

The big picture: from Perception to Planning to Control

The big picture: from Perception to Planning to Control The big picture: from Perception to Planning to Control Perception Location, Map Signals: video, inertial, range Sensors Real World 1 Planning vs Control 0. In control we go from to A to B in free space

More information

Point Location. The Slab Method. Optimal Schemes. The Slab Method. Preprocess a planar, polygonal subdivision for point location queries.

Point Location. The Slab Method. Optimal Schemes. The Slab Method. Preprocess a planar, polygonal subdivision for point location queries. Point Location The Slab Method Prerocess a lanar, olygonal sbdiision for oint location qeries. = (18, 11) raw a ertical line throgh each ertex. This decomoses the lane into slabs. In each slab, the ertical

More information

Dijkstra s Algorithm. Single source shortest paths for a directed acyclic graph

Dijkstra s Algorithm. Single source shortest paths for a directed acyclic graph Dijkstra s Algorithm Single source shortest paths for a directed acyclic graph Single-Source Shortest Paths We want to find the shortest paths between Binghamton and New York City, Boston, and Washington

More information

Minimum Spanning Trees Ch 23 Traversing graphs

Minimum Spanning Trees Ch 23 Traversing graphs Net: Graph Algorithms Graphs Ch 22 Graph representations adjacenc list adjacenc matri Minimum Spanning Trees Ch 23 Traersing graphs Breadth-First Search Depth-First Search 7/16/2013 CSE 3101 1 Graphs Definition

More information

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

CS 341: Algorithms. Douglas R. Stinson. David R. Cheriton School of Computer Science University of Waterloo. February 26, 2019 CS 341: Algorithms Douglas R. Stinson David R. Cheriton School of Computer Science University of Waterloo February 26, 2019 D.R. Stinson (SCS) CS 341 February 26, 2019 1 / 296 1 Course Information 2 Introduction

More information

Planarity-Preserving Clustering and Embedding for Large Planar Graphs

Planarity-Preserving Clustering and Embedding for Large Planar Graphs Planarity-Presering Clstering and Embedding for Large Planar Graphs Christian A. Dncan, Michael T. Goodrich, and Stephen G. Koboro Center for Geometric Compting The Johns Hopkins Uniersity Baltimore, MD

More information

[1] Hopcroft, J., D. Joseph and S. Whitesides, Movement problems for twodimensional

[1] Hopcroft, J., D. Joseph and S. Whitesides, Movement problems for twodimensional Acknoledgement. The athors thank Bill Lenhart for interesting discssions on the recongration of rlers. References [1] Hopcroft, J., D. Joseph and S. Whitesides, Moement problems for todimensional linkages,

More information

Multiple Source Shortest Paths in a Genus g Graph

Multiple Source Shortest Paths in a Genus g Graph Mltiple Sorce Shortest Paths in a Gens g Graph Sergio Cabello Erin W. Chambers Abstract We gie an O(g n log n) algorithm to represent the shortest path tree from all the ertices on a single specified face

More information

CSC 8301 Design & Analysis of Algorithms: Kruskal s and Dijkstra s Algorithms

CSC 8301 Design & Analysis of Algorithms: Kruskal s and Dijkstra s Algorithms CSC 8301 Design & Analysis of Algorithms: Kruskal s and Dijkstra s Algorithms Professor Henry Carter Fall 2016 Recap Greedy algorithms iterate locally optimal choices to construct a globally optimal solution

More information

CSE 421 Greedy Alg: Union Find/Dijkstra s Alg

CSE 421 Greedy Alg: Union Find/Dijkstra s Alg CSE 1 Greedy Alg: Union Find/Dijkstra s Alg Shayan Oveis Gharan 1 Dijkstra s Algorithm Dijkstra(G, c, s) { d s 0 foreach (v V) d[v] //This is the key of node v foreach (v V) insert v onto a priority queue

More information

v e v 1 C 2 b) Completely assigned T v a) Partially assigned Tv e T v 2 p k

v e v 1 C 2 b) Completely assigned T v a) Partially assigned Tv e T v 2 p k Approximation Algorithms for a Capacitated Network Design Problem R. Hassin 1? and R. Rai 2?? and F. S. Salman 3??? 1 Department of Statistics and Operations Research, Tel-Ai Uniersity, Tel Ai 69978, Israel.

More information

Minimum Spanning Trees

Minimum Spanning Trees Minimum Spanning Trees Problem A town has a set of houses and a set of roads. A road connects 2 and only 2 houses. A road connecting houses u and v has a repair cost w(u, v). Goal: Repair enough (and no

More information

Shortest Paths. Nishant Mehta Lectures 10 and 11

Shortest Paths. Nishant Mehta Lectures 10 and 11 Shortest Paths Nishant Mehta Lectures 0 and Communication Speeds in a Computer Network Find fastest way to route a data packet between two computers 6 Kbps 4 0 Mbps 6 6 Kbps 6 Kbps Gbps 00 Mbps 8 6 Kbps

More information

Shortest Path Problem

Shortest Path Problem Shortest Path Problem CLRS Chapters 24.1 3, 24.5, 25.2 Shortest path problem Shortest path problem (and variants) Properties of shortest paths Algorithmic framework Bellman-Ford algorithm Shortest paths

More information

CS420/520 Algorithm Analysis Spring 2009 Lecture 14

CS420/520 Algorithm Analysis Spring 2009 Lecture 14 CS420/520 Algorithm Analysis Spring 2009 Lecture 14 "A Computational Analysis of Alternative Algorithms for Labeling Techniques for Finding Shortest Path Trees", Dial, Glover, Karney, and Klingman, Networks

More information

CS4800: Algorithms & Data Jonathan Ullman

CS4800: Algorithms & Data Jonathan Ullman CS4800: Algorithms & Data Jonathan Ullman Lecture 13: Shortest Paths: Dijkstra s Algorithm, Heaps DFS(?) Feb 0, 018 Navigation s 9 15 14 5 6 3 18 30 11 5 0 16 4 6 6 3 19 t Weighted Graphs A graph with

More information

Lecture 11: Analysis of Algorithms (CS ) 1

Lecture 11: Analysis of Algorithms (CS ) 1 Lecture 11: Analysis of Algorithms (CS583-002) 1 Amarda Shehu November 12, 2014 1 Some material adapted from Kevin Wayne s Algorithm Class @ Princeton 1 2 Dynamic Programming Approach Floyd-Warshall Shortest

More information

Shortest Paths. Nishant Mehta Lectures 10 and 11

Shortest Paths. Nishant Mehta Lectures 10 and 11 Shortest Paths Nishant Mehta Lectures 0 and Finding the Fastest Way to Travel between Two Intersections in Vancouver Granville St and W Hastings St Homer St and W Hastings St 6 Granville St and W Pender

More information

Fixed-Parameter Algorithms for Cluster Vertex Deletion

Fixed-Parameter Algorithms for Cluster Vertex Deletion Fixed-Parameter Algorithms for Clster Vertex Deletion Falk Hüffner Christian Komsieicz Hannes Moser Rolf Niedermeier Institt für Informatik, Friedrich-Schiller-Uniersität Jena, Ernst-Abbe-Platz 2, D-07743

More information

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

Single-Source Shortest Paths. CSE 2320 Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington Single-Source Shortest Paths CSE Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington Terminology A network is a directed graph. We will use both terms interchangeably. The

More information

Assignments. Computer Networks LECTURE 7 Network Layer: Routing and Addressing. Network Layer Function. Internet Architecture

Assignments. Computer Networks LECTURE 7 Network Layer: Routing and Addressing. Network Layer Function. Internet Architecture ompter Netorks LETURE Netork Laer: Roting and ddressing ssignments Project : Web Pro Serer DUE OT Sandha Darkadas Department of ompter Science Uniersit of Rochester Internet rchitectre Bottom-p: phsical:

More information

The Shortest Path Problem

The Shortest Path Problem The Shortest Path Problem 1 Shortest-Path Algorithms Find the shortest path from point A to point B Shortest in time, distance, cost, Numerous applications Map navigation Flight itineraries Circuit wiring

More information

CSE 100 Minimum Spanning Trees Prim s and Kruskal

CSE 100 Minimum Spanning Trees Prim s and Kruskal CSE 100 Minimum Spanning Trees Prim s and Kruskal Your Turn The array of vertices, which include dist, prev, and done fields (initialize dist to INFINITY and done to false ): V0: dist= prev= done= adj:

More information

Queries. Inf 2B: Ranking Queries on the WWW. Suppose we have an Inverted Index for a set of webpages. Disclaimer. Kyriakos Kalorkoti

Queries. Inf 2B: Ranking Queries on the WWW. Suppose we have an Inverted Index for a set of webpages. Disclaimer. Kyriakos Kalorkoti Qeries Inf B: Ranking Qeries on the WWW Kyriakos Kalorkoti School of Informatics Uniersity of Edinbrgh Sppose e hae an Inerted Index for a set of ebpages. Disclaimer I Not really the scenario of Lectre.

More information

On Plane Constrained Bounded-Degree Spanners

On Plane Constrained Bounded-Degree Spanners On Plane Constrained Bonded-Degree Spanners Prosenjit Bose 1, Rolf Fagerberg 2, André an Renssen 1, Sander Verdonschot 1 1 School of Compter Science, Carleton Uniersity, Ottaa, Canada. Email: jit@scs.carleton.ca,

More information

Motivation: Art gallery problem. Polygon decomposition. Art gallery problem: upper bound. Art gallery problem: lower bound

Motivation: Art gallery problem. Polygon decomposition. Art gallery problem: upper bound. Art gallery problem: lower bound CG Lecture 3 Polygon decomposition 1. Polygon triangulation Triangulation theory Monotone polygon triangulation 2. Polygon decomposition into monotone pieces 3. Trapezoidal decomposition 4. Conex decomposition

More information

Shortest Path Algorithms

Shortest Path Algorithms Shortest Path Algorithms Andreas Klappenecker [based on slides by Prof. Welch] 1 Single Source Shortest Path Given: a directed or undirected graph G = (V,E) a source node s in V a weight function w: E

More information

Introduction to Algorithms

Introduction to Algorithms Introduction to Algorithms 6.046J/18.401J LECTURE 13 Graph algorithms Graph representation Minimum spanning trees Greedy algorithms Optimal substructure Greedy choice Prim s greedy MST algorithm Prof.

More information

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

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved. Chapter 9 Greedy Technique Copyright 2007 Pearson Addison-Wesley. All rights reserved. Greedy Technique Constructs a solution to an optimization problem piece by piece through a sequence of choices that

More information

Introduction to Algorithms

Introduction to Algorithms Introduction to Algorithms 6.046J/18.401J LECTURE 16 Greedy Algorithms (and Graphs) Graph representation Minimum spanning trees Optimal substructure Greedy choice Prim s greedy MST algorithm Prof. Charles

More information

Single Source Shortest Path

Single Source Shortest Path Single Source Shortest Path A directed graph G = (V, E) and a pair of nodes s, d is given. The edges have a real-valued weight W i. This time we are looking for the weight and the shortest path from s

More information

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

Graphs. Part II: SP and MST. Laura Toma Algorithms (csci2200), Bowdoin College Laura Toma Algorithms (csci2200), Bowdoin College Topics Weighted graphs each edge (u, v) has a weight denoted w(u, v) or w uv stored in the adjacency list or adjacency matrix The weight of a path p =

More information

Mathematical model for storing and effective processing of directed graphs in semistructured data management systems

Mathematical model for storing and effective processing of directed graphs in semistructured data management systems Mathematical model for storing and effectie processing of directed graphs in semistrctred data management MALIKOV A, GULEVSKIY Y, PARKHOMENKO D Information Systems and Technologies Department North Cacass

More information

A New Multicast Wavelength Assignment Algorithm in Wavelength-Converted Optical Networks

A New Multicast Wavelength Assignment Algorithm in Wavelength-Converted Optical Networks Int J Communications, Network and System Sciences, 2009, 2, 912-916 doi:104236/ijcns200929106 Published Online December 2009 (http://wwwscirporg/journal/ijcns/) A New Multicast Waelength Assignment Algorithm

More information

4.4 Shortest Paths. Dijkstra's algorithm implementation acyclic networks negative weights. Reference: Algorithms in Java, 4 th edition, Section 4.

4.4 Shortest Paths. Dijkstra's algorithm implementation acyclic networks negative weights. Reference: Algorithms in Java, 4 th edition, Section 4. 4.4 Shortest Paths Dijkstra's algorithm implementation acyclic networks negative weights Reference: Algorithms in Java, 4 th edition, Section 4.4 Algorithms in Java, 4 th Edition Robert Sedgewick and Kevin

More information

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

22 Elementary Graph Algorithms. There are two standard ways to represent a VI Graph Algorithms Elementary Graph Algorithms Minimum Spanning Trees Single-Source Shortest Paths All-Pairs Shortest Paths 22 Elementary Graph Algorithms There are two standard ways to represent a graph

More information

Chapter 7 TOPOLOGY CONTROL

Chapter 7 TOPOLOGY CONTROL Chapter TOPOLOGY CONTROL Oeriew Topology Control Gabriel Graph et al. XTC Interference SINR & Schedling Complexity Distribted Compting Grop Mobile Compting Winter 00 / 00 Distribted Compting Grop MOBILE

More information

Network layer. Two Key Network-Layer Functions. Datagram Forwarding table. IP datagram format. IP Addressing: introduction

Network layer. Two Key Network-Layer Functions. Datagram Forwarding table. IP datagram format. IP Addressing: introduction Netork laer transport segment sending to receiing host on sending side encapslates segments into grams on rcing side, deliers segments to transport laer laer protocols in eer host, roter roter eamines

More information

Fundamental Algorithms CSCI-GA /Summer Solution to Homework 8

Fundamental Algorithms CSCI-GA /Summer Solution to Homework 8 Fundamental Algorithms CSCI-GA.70-00/Summer 206 Solution to Homework 8 Problem (CLRS 23.-6). ( point) Show that a graph has a unique minimum spanning tree if, for every cut of the graph, there is a unique

More information

Review of course COMP-251B winter 2010

Review of course COMP-251B winter 2010 Review of course COMP-251B winter 2010 Lecture 1. Book Section 15.2 : Chained matrix product Matrix product is associative Computing all possible ways of parenthesizing Recursive solution Worst-case running-time

More information

On shortest-path all-optical networks without wavelength conversion requirements

On shortest-path all-optical networks without wavelength conversion requirements Research Collection Working Paper On shortest-path all-optical networks withot waelength conersion reqirements Athor(s): Erlebach, Thomas; Stefanakos, Stamatis Pblication Date: 2002 Permanent Link: https://doi.org/10.3929/ethz-a-004446054

More information

OPTI-502 Optical Design and Instrumentation I John E. Greivenkamp Homework Set 7 Fall, 2018

OPTI-502 Optical Design and Instrumentation I John E. Greivenkamp Homework Set 7 Fall, 2018 Assigned: 10/10/18 Lectre 15 De: 10/17/18 Lectre 17 Midterm Exam: Wednesda October 24 (Lectre 19) The eqation sheet for the exam has been posted on the corse website. This eqation sheet will be inclded

More information

CS 310 Advanced Data Structures and Algorithms

CS 310 Advanced Data Structures and Algorithms CS 0 Advanced Data Structures and Algorithms Weighted Graphs July 0, 07 Tong Wang UMass Boston CS 0 July 0, 07 / Weighted Graphs Each edge has a weight (cost) Edge-weighted graphs Mostly we consider only

More information

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

Computer Science & Engineering 423/823 Design and Analysis of Algorithms Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 07 Single-Source Shortest Paths (Chapter 24) Stephen Scott and Vinodchandran N. Variyam sscott@cse.unl.edu 1/36 Introduction

More information

Networks An introduction to microcomputer networking concepts

Networks An introduction to microcomputer networking concepts Behavior Research Methods& Instrmentation 1978, Vol 10 (4),522-526 Networks An introdction to microcompter networking concepts RALPH WALLACE and RICHARD N. JOHNSON GA TX, Chicago, Illinois60648 and JAMES

More information

Solutions to relevant spring 2000 exam problems

Solutions to relevant spring 2000 exam problems Problem 2, exam Here s Prim s algorithm, modified slightly to use C syntax. MSTPrim (G, w, r): Q = V[G]; for (each u Q) { key[u] = ; key[r] = 0; π[r] = 0; while (Q not empty) { u = ExtractMin (Q); for

More information

Chapter 25: All-Pairs Shortest-Paths

Chapter 25: All-Pairs Shortest-Paths Chapter : All-Pairs Shortest-Paths When no negative edges Some Algorithms Using Dijkstra s algorithm: O(V ) Using Binary heap implementation: O(VE lg V) Using Fibonacci heap: O(VE + V log V) When no negative

More information

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

Outline. (single-source) shortest path. (all-pairs) shortest path. minimum spanning tree. Dijkstra (Section 4.4) Bellman-Ford (Section 4. Weighted Graphs 1 Outline (single-source) shortest path Dijkstra (Section 4.4) Bellman-Ford (Section 4.6) (all-pairs) shortest path Floyd-Warshall (Section 6.6) minimum spanning tree Kruskal (Section 5.1.3)

More information

Lecture 13: Traffic Engineering

Lecture 13: Traffic Engineering Lectre 13: Traffic Engineering CSE 222A: Compter Commnication Networks Alex C. Snoeren Thanks: Mike Freedman, Nick Feamster, and Ming Zhang Lectre 13 Overview Dealing with mltiple paths Mltihoming Entact

More information

C Puzzles! Taken from old exams. Integers Sep 3, Encoding Integers Unsigned. Encoding Example (Cont.) The course that gives CMU its Zip!

C Puzzles! Taken from old exams. Integers Sep 3, Encoding Integers Unsigned. Encoding Example (Cont.) The course that gives CMU its Zip! 15-13 The corse that gies CMU its Zip! Topics class3.ppt Integers Sep 3,! Nmeric Encodings " Unsigned & Two s complement! Programming Implications " C promotion rles! Basic operations " Addition, negation,

More information

Graph Applications. Topological Sort Shortest Path Problems Spanning Trees. Data Structures 1 Graph Applications

Graph Applications. Topological Sort Shortest Path Problems Spanning Trees. Data Structures 1 Graph Applications Graph Applications Topological Sort Shortest Path Problems Spanning Trees Data Structures 1 Graph Applications Application: Topological Sort Given a set of jobs, courses, etc. with prerequisite constraints,

More information

MST & Shortest Path -Prim s -Djikstra s

MST & Shortest Path -Prim s -Djikstra s MST & Shortest Path -Prim s -Djikstra s PRIM s - Minimum Spanning Tree - A spanning tree of a graph is a tree that has all the vertices of the graph connected by some edges. - A graph can have one or more

More information

Basic Graph Definitions

Basic Graph Definitions CMSC 341 Graphs Basic Graph Definitions A graph G = (V,E) consists of a finite set of vertices, V, and a finite set of edges, E. Each edge is a pair (v,w) where v, w V. V and E are sets, so each vertex

More information

Algorithms and Data Structures: Minimum Spanning Trees I and II - Prim s Algorithm. ADS: lects 14 & 15 slide 1

Algorithms and Data Structures: Minimum Spanning Trees I and II - Prim s Algorithm. ADS: lects 14 & 15 slide 1 Algorithms and Data Structures: Minimum Spanning Trees I and II - Prim s Algorithm ADS: lects 14 & 15 slide 1 Weighted Graphs Definition 1 A weighted (directed or undirected graph) is a pair (G, W ) consisting

More information

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

22 Elementary Graph Algorithms. There are two standard ways to represent a VI Graph Algorithms Elementary Graph Algorithms Minimum Spanning Trees Single-Source Shortest Paths All-Pairs Shortest Paths 22 Elementary Graph Algorithms There are two standard ways to represent a graph

More information

International Journal of Multidisciplinary Research and Modern Education (IJMRME) Impact Factor: 6.725, ISSN (Online):

International Journal of Multidisciplinary Research and Modern Education (IJMRME) Impact Factor: 6.725, ISSN (Online): COMPUTER REPRESENTATION OF GRAPHS USING BINARY LOGIC CODES IN DISCRETE MATHEMATICS S. Geetha* & Dr. S. Jayakumar** * Assistant Professor, Department of Mathematics, Bon Secours College for Women, Villar

More information

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

from notes written mostly by Dr. Carla Savage: All Rights Reserved CSC 505, Fall 2000: Week 9 Objectives: learn about various issues related to finding shortest paths in graphs learn algorithms for the single-source shortest-path problem observe the relationship among

More information

ABSOLUTE DEFORMATION PROFILE MEASUREMENT IN TUNNELS USING RELATIVE CONVERGENCE MEASUREMENTS

ABSOLUTE DEFORMATION PROFILE MEASUREMENT IN TUNNELS USING RELATIVE CONVERGENCE MEASUREMENTS Proceedings th FIG Symposim on Deformation Measrements Santorini Greece 00. ABSOUTE DEFORMATION PROFIE MEASUREMENT IN TUNNES USING REATIVE CONVERGENCE MEASUREMENTS Mahdi Moosai and Saeid Khazaei Mining

More information

Recitation 13. Minimum Spanning Trees Announcements. SegmentLab has been released, and is due Friday, November 17. It s worth 135 points.

Recitation 13. Minimum Spanning Trees Announcements. SegmentLab has been released, and is due Friday, November 17. It s worth 135 points. Recitation 13 Minimum Spanning Trees 13.1 Announcements SegmentLab has been released, and is due Friday, November 17. It s worth 135 points. 73 74 RECITATION 13. MINIMUM SPANNING TREES 13.2 Prim s Algorithm

More information