CS 101 – Nov. 30 Communication, continued TCP/IP review Dijkstra’s shortest path algorithm Download speeds.

Slides:



Advertisements
Similar presentations
Chapter 9: Graphs Shortest Paths
Advertisements

CSE 390B: Graph Algorithms Based on CSE 373 slides by Jessica Miller, Ruth Anderson 1.
Chapter 4 Distributed Bellman-Ford Routing
Reducibility Class of problems A can be reduced to the class of problems B Take any instance of problem A Show how you can construct an instance of problem.
CS 206 Introduction to Computer Science II 03 / 27 / 2009 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 11 / 07 / 2008 Instructor: Michael Eckmann.
Graphs By JJ Shepherd. Introduction Graphs are simply trees with looser restrictions – You can have cycles Historically hard to deal with in computers.
Chapter 7: Greedy Algorithms 7.4 Finding the Shortest Path Dijkstra’s Algorithm pp
1 Dijkstra's Shortest Path Algorithm Find shortest path from s to t. s 3 t
1 Dijkstra's Shortest Path Algorithm Find shortest path from s to t. s 3 t
Shortest Path Problems Directed weighted graph. Path length is sum of weights of edges on path. The vertex at which the path begins is the source vertex.
Discrete Math for CS Chapter 8: Directed Graphs. Discrete Math for CS digraph: A digraph is a graph G = (V,E) where V is a finite set of vertices and.
CS 206 Introduction to Computer Science II 03 / 30 / 2009 Instructor: Michael Eckmann.
The Travelling Salesman Algorithm A Salesman has to visit lots of different stores and return to the starting base On a graph this means visiting every.
Quickest Route B St Li C La time matrix (minutes) Liskeard Launceston Callington St Austell Bodmin 32 What is the quickest route from.
Routing Protocols and the IP Layer CS244A Review Session 2/01/08 Ben Nham Derived from slides by: Paul Tarjan Martin Casado Ari Greenberg.
Chapter 4: Finding the Shortest Path Lesson 1: Dijkstra’s Algorithm
Using Dijkstra’s Algorithm to Find a Shortest Path from a to z 1.
Shortest Path. Dijkstra’s Algorithm finds the shortest path from the start vertex to every other vertex in the network. We will find the shortest path.
Geography and CS Philip Chan. How do I get there? Navigation Which web sites can give you turn-by-turn directions?
Dijkstras Algorithm Named after its discoverer, Dutch computer scientist Edsger Dijkstra, is an algorithm that solves the single-source shortest path problem.
CS 101 – Dec. 2 Download speed Internet vs. Web Domains HTML.
SPANNING TREES Lecture 21 CS2110 – Spring
Graphs and Trees Graph theory Purpose: Overall goals
Graph Theory Hamilton Paths and Hamilton Circuits.
COSC 2007 Data Structures II Chapter 14 Graphs III.
Shortest Path Problem Weight of the graph –Nonnegative real number assigned to the edges connecting to vertices Weighted graphs –When a graph.
6.1 Hamilton Circuits and Paths: Hamilton Circuits and Paths: Hamilton Path: Travels to each vertex once and only once… Hamilton Path: Travels to each.
Data Structures and Algorithms Ver. 1.0 Session 17 Objectives In this session, you will learn to: Implement a graph Apply graphs to solve programming problems.
CS 111 – Oct. 11 Internet topics –Network applications and technology for business –Security Commitment: –Quiz Wednesday. –Homework #1 due Oct. 18: Discuss.
Computer System Building blocks of a computer system: Using bits –Binary data and operations –Logic gates Units of measuring amount of data CPU vs. memory.
Shortest Path Problems Dijkstra’s Algorithm. Introduction Many problems can be modeled using graphs with weights assigned to their edges: Airline flight.
Liskeard Launceston Callington St Austell Bodmin Starter Find the quickest route from St Austell to Launceston.
Internet Routing r Routing algorithms m Link state m Distance Vector m Hierarchical routing r Routing protocols m RIP m OSPF m BGP.
Graphs A ‘Graph’ is a diagram that shows how things are connected together. It makes no attempt to draw actual paths or routes and scale is generally inconsequential.
CS 101 – Nov. 23 Communication, continued LANs –Bus (ethernet) communication –Token ring communication How the Internet works: TCP/IP.
SPANNING TREES Lecture 20 CS2110 – Fall Spanning Trees  Definitions  Minimum spanning trees  3 greedy algorithms (incl. Kruskal’s & Prim’s)
CS 361 – Chapter 14 Weighted graph –How would you represent? Shortest path algorithms from 1 vertex to any other: –General –Handling negative weight –Acyclic.
Decision Maths 1 Shortest path algorithm Dijkstra’s Algorithm A V Ali :
A Introduction to Computing II Lecture 16: Dijkstra’s Algorithm Fall Session 2000.
18-WAN Technologies and Dynamic routing Dr. John P. Abraham Professor UTPA.
Network Layer (2). Review Physical layer: move bits between physically connected stations Data link layer: move frames between physically connected stations.
Graphs + Shortest Paths David Kauchak cs302 Spring 2013.
Chapter 14 Section 3 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.
Graphs – Part III CS 367 – Introduction to Data Structures.
Network Layer.
Hamilton Paths and Hamilton Circuits
COMP108 Algorithmic Foundations Greedy methods
Shortest Path from G to C Using Dijkstra’s Algorithm
Chapter 7: Greedy Algorithms
CS 457 – Lecture 12 Routing Spring 2012.
Routing: Distance Vector Algorithm
Decision Maths Dijkstra’s Algorithm.
Graphs Chapter 11 Objectives Upon completion you will be able to:
Shortest Path.
Shortest Path.
CSE 373: Data Structures and Algorithms
Floyd’s Algorithm (shortest-path problem)
Shortest Path Algorithm for Weighted Non-negative Undirected Graphs
Shortest Path.
Weighted Graphs & Shortest Paths
CSE 373 Data Structures and Algorithms
EE 122: Intra-domain routing: Distance Vector
Dijkstra's Shortest Path Algorithm
Spanning Trees Lecture 20 CS2110 – Spring 2015.
Lecture 12 Shortest Path.
Traveling Salesman Problems Nearest Neighbor Method
Network Layer.
Graphs: Shortest path and mst
Shortest Route Problems
Presentation transcript:

CS 101 – Nov. 30 Communication, continued TCP/IP review Dijkstra’s shortest path algorithm Download speeds

Snooping The “dark side” of TCP/IP Web site can track you by IP address –Localized marketing –Privacy concerns Anonymous IP servers –Ex. “Anonymouse”

Dijkstra’s algorithm How do you find the shortest path in a network? General case solved by Edsger Dijkstra,

Let’s say we want to go from “A” to “Z”. The idea is to label each vertex with a number – its best known distance from A. As we work, we may find a cheaper distance, until we “mark” or finalize the vertex. 1.Label A with 0, and mark A. 2.Label A’s neighbors with their distances from A. 3.Find the lowest unmarked vertex and mark it. Let’s call this vertex “B”. 4.Recalculate distances for B’s neighbors via B. Some of these neighbors may now have a shorter known distance. 5.Repeat steps 3 and 4 until you mark Z A BC Z

First, we label A with 0. Mark A as final. The neighbors of A are B and C. Label B = 4 and C = 7. Now, the unmarked vertices are B=4 and C=7. The lowest of these is B. Mark B, and recalculate B’s neighbors via B. The neighbors of B are C and Z. –If we go to C via B, the total distance is 4+2 = 6. This is better than the old distance of 7. So re-label C = 6. –If we go to Z via B, the total distance is = A BC Z

Now, the unmarked vertices are C=6 and Z=7. The lowest of these is C. Mark C, and recalculate C’s neighbors via B. The only unmarked neighbor of C is Z. –If we go to Z via C, the total distance is 6+4 = 10. This is worse than the current distance to Z, so Z’s label is unchanged. The only unmarked vertex now is Z, so we mark it and we are done. Its label is the shortest distance from A A BC Z

Postscript. I want to clarify something… The idea is to label each vertex with a number – its best known distance from A. As we work, we may find a cheaper distance, until we “mark” or finalize the vertex. When you are mark a vertex and look to recalculate distances to its neighbors: –We don’t need to recalculate distance for a vertex if marked. So, only consider unmarked neighbors. –We only update a vertex’s distance if it is an improvement: if it’s shorter than what we previously had A BC Z

Shortest Paths Dijkstra’s algorithm: What is the shortest distance between 2 points in a network/graph ? A related problem: What is the shortest distance for me to visit all the points in the graph and return home? This is called the traveling salesman problem. Open question in CS: why is this problem so hard?

B A C DE

Measuring speed Overhead = prepare & assemble message Flight time = first bit to arrive at destination Bandwidth = max rate to propagate data (cruising speed) Total time = overhead + flight time + (msg size)/bandwidth

How much longer? FileSizeProgress“time left”rate #1815 KB65.1%3:081.5 KB/s #25.9 MB64.8%24:031.5 KB/s

Examples