Shortest-Paths Trees Kun-Mao Chao (趙坤茂)

Slides:



Advertisements
Similar presentations
Bellman-Ford algorithm
Advertisements

Single Source Shortest Paths
* Bellman-Ford: single-source shortest distance * O(VE) for graphs with negative edges * Detects negative weight cycles * Floyd-Warshall: All pairs shortest.
DIJKSTRA’s Algorithm. Definition fwd search Find the shortest paths from a given SOURCE node to ALL other nodes, by developing the paths in order of increasing.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 CHAPTER 4 - PART 2 GRAPHS 1.
Minimum Spanning Trees Kun-Mao Chao ( 趙坤茂 ) Department of Computer Science and Information Engineering National Taiwan University, Taiwan
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
Chapter 9 Graph algorithms Lec 21 Dec 1, Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
The Shortest Path Problem
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Graph Algorithms: Minimum.
CS 146: Data Structures and Algorithms July 21 Class Meeting
Counting Spanning Trees Kun-Mao Chao ( 趙坤茂 ) Department of Computer Science and Information Engineering National Taiwan University, Taiwan
Using Dijkstra’s Algorithm to Find a Shortest Path from a to z 1.
Graph (II) Shortest path, Minimum spanning tree GGuy
Minimum Routing Cost Spanning Trees Kun-Mao Chao ( 趙坤茂 ) Department of Computer Science and Information Engineering National Taiwan University, Taiwan.
Lecture 23 CSE 331 Oct 24, Reminder 2 points for Piazza participation 3 points for mini-project.
Decision Maths 1 Shortest path algorithm Dijkstra’s Algorithm A V Ali :
Spanning Trees Dijkstra (Unit 10) SOL: DM.2 Classwork worksheet Homework (day 70) Worksheet Quiz next block.
Data Structures and Algorithms
Shortest Paths.
Shortest Paths C B A E D F Shortest Paths
Shortest Path Problems
Data Structures and Algorithms I Day 19, 11/3/11 Edge-Weighted Graphs
Shortest Paths and Minimum Spanning Trees
Shortest Path 6/18/2018 4:22 PM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
Shortest Path from G to C Using Dijkstra’s Algorithm
Dijkstra’s shortest path Algorithm
Minimum Spanning Tree Chapter 13.6.
Shortest Paths C B A E D F Shortest Paths
Lecture 23 CSE 331 Oct 26, 2016.
Shortest Paths C B A E D F Shortest Paths
Party-by-Night Problem
Dijkstra’s Algorithm We are given a directed weighted graph
Minimum Spanning Trees
Shortest Paths C B A E D F Shortest Paths
Shortest Paths C B A E D F Shortest Paths
Shortest Paths.
Lecture 24 CSE 331 Oct 25, 2013.
Lecture 22 CSE 331 Oct 23, 2017.
Lecture 23 CSE 331 Oct 25, 2017.
Lecture 24 CSE 331 Oct 29, 2012.
Lecture 23 CSE 331 Oct 24, 2011.
Lecture 22 CSE 331 Oct 24, 2016.
Shortest Path Algorithms
Shortest Paths and Minimum Spanning Trees
Minimum Spanning Trees
Honors Track: Competitive Programming & Problem Solving Avoiding negative edges Steven Ge.
Lecture 14 Shortest Path (cont’d) Minimum Spanning Tree
The Bellman-Ford Shortest Path Algorithm Neil Tang 03/27/2008
Shortest Path Problems
Shortest Path Algorithm for Weighted Non-negative Undirected Graphs
Single Source Shortest Paths Dijkstra’s Alg. (no negative lengths!)
Lecture 24 CSE 331 Oct 24, 2014.
Weighted Graphs & Shortest Paths
Autumn 2016 Lecture 10 Minimum Spanning Trees
Lecture 23 CSE 331 Oct 24, 2011.
Shortest Paths.
Lecture 26 CSE 331 Nov 1, 2010.
CSE 417: Algorithms and Computational Complexity
Minimum Spanning Trees
Shortest Path Solutions
Trees Kun-Mao Chao (趙坤茂)
Prim’s algorithm for minimum spanning trees
Winter 2019 Lecture 10 Minimum Spanning Trees
Lecture 13 Shortest Path (cont’d) Minimum Spanning Tree
Trees Kun-Mao Chao (趙坤茂)
Minimum Spanning Trees
CSCI 465 Data Communications and Networks Lecture 16
Multiple Sequence Alignment
Presentation transcript:

Shortest-Paths Trees Kun-Mao Chao (趙坤茂) Department of Computer Science and Information Engineering National Taiwan University, Taiwan E-mail: kmchao@csie.ntu.edu.tw WWW: http://www.csie.ntu.edu.tw/~kmchao

Shortest-Paths Trees 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. In order to minimize the total path lengths, the path from the source to each node must be a shortest path connecting them.

Shortest-Paths Trees

Negative edges in an undirected graph

Directed graphs

Dijkstra's Algorithm

Choose a

Relax (a, b) and (a, g)

Choose b; Add (a, b) to T

Relax (b, c) and (b, d)

Choose g; Add (a, g) to T

Relax (g, e) and (g, h)

Choose d; Add (b, d) to T

Relax (d, e)

Choose h; Add (g, h) to T

Choose e; Add (d, e) to T

Relax (e, f)

Choose c; Add (b, c) to T

Relax (c, h)

Choose f; Add (e, f) to T

Relax (f, d) and (f, h)

The resulting SPT

Negative edge

Choose a

Choose b; Add (a, b) to T

Choose d; Add (b, d) to T

Choose c; Add (b, c) to T

Choose e; Add (d, e) to T

Something went wrong

A wrong SPT

A correct SPT

The Bellman-Ford Algorithm

δ[b] and δ[g] modified

δ[c], δ[d], δ[e] and δ[h] modified

δ[f] modified

δ[h] modified

A correct SPT

Try this in class