Warm Up. Correct order: s,u,v,y,x,w,t

Similar documents
CMPS 6610/4610 Fall Flow Networks. Carola Wenk Slides adapted from slides by Charles Leiserson

Network flows. The problem. c : V V! R + 0 [ f+1g. flow network G = (V, E, c), a source s and a sink t uv not in E implies c(u, v) = 0

Maximum Flow 5/6/17 21:08. Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015

Wrap up: Weighted, directed graph shortest path Minimum Spanning Tree. Feb 25, 2019 CSCI211 - Sprenkle

Algorithmic Discrete Mathematics 6. Exercise Sheet

Randomized Perfect Bipartite Matching

Main Reference: Sections in CLRS.

Algorithms and Data Structures 2011/12 Week 9 Solutions (Tues 15th - Fri 18th Nov)

20/20 20/20 0/5 0/5 20/20 20/20 5/5 0/5 0/5 5/5 0/20 25/30 20/20 30/30 20/20 0/5 5/5 20/20 0/5 0/5 15/20 15/25 20/20 10/10

Maximum Flow 3/3 4/6 1/1 4/7 3/3. s 3/5 1/9 1/1 3/5 2/2. 1/18/2005 4:03 AM Maximum Flow 1

Problem Set If all directed edges in a network have distinct capacities, then there is a unique maximum flow.

Math 2214 Solution Test 1 B Spring 2016

PHYSICS 151 Notes for Online Lecture #4

18 Extensions of Maximum Flow

s in boxe wers ans Put

EF 151 Exam #2 - Spring, 2014 Page 1 of 6

Main Ideas in Class Today

Rectilinear Kinematics

Dynamic Programming 11/8/2009. Weighted Interval Scheduling. Weighted Interval Scheduling. Unweighted Interval Scheduling: Review

CS 473G Lecture 15: Max-Flow Algorithms and Applications Fall 2005

Flow Networks Alon Efrat Slides courtesy of Charles Leiserson with small changes by Carola Wenk. Flow networks. Flow networks CS 445

Network Flow. Data Structures and Algorithms Andrei Bulatov

Differential Geometry: Revisiting Curvatures

Physics Notes - Ch. 2 Motion in One Dimension

Lecture 2-1 Kinematics in One Dimension Displacement, Velocity and Acceleration Everything in the world is moving. Nothing stays still.

Chapter 3 Kinematics in Two Dimensions

Chapter 7: Solving Trig Equations

Kinematics in two dimensions

16 Max-Flow Algorithms and Applications

Today: Max Flow Proofs

LAB # 2 - Equilibrium (static)

Max Flow, Min Cut COS 521. Kevin Wayne Fall Soviet Rail Network, Cuts. Minimum Cut Problem. Flow network.

Network Flow Applications

Brock University Physics 1P21/1P91 Fall 2013 Dr. D Agostino. Solutions for Tutorial 3: Chapter 2, Motion in One Dimension

The Residual Graph. 11 Augmenting Path Algorithms. Augmenting Path Algorithm. Augmenting Path Algorithm

Notes on cointegration of real interest rates and real exchange rates. ρ (2)

1. The graph below shows the variation with time t of the acceleration a of an object from t = 0 to t = T. a

Maximum Flow in Planar Graphs

Flow networks. Flow Networks. A flow on a network. Flow networks. The maximum-flow problem. Introduction to Algorithms, Lecture 22 December 5, 2001

The Residual Graph. 12 Augmenting Path Algorithms. Augmenting Path Algorithm. Augmenting Path Algorithm

CSE 521: Design & Analysis of Algorithms I

HYPOTHESIS TESTING. four steps. 1. State the hypothesis. 2. Set the criterion for rejecting. 3. Compute the test statistics. 4. Interpret the results.

PHYSICS Solving Equations

TP B.2 Rolling resistance, spin resistance, and "ball turn"

Soviet Rail Network, 1955

Admin MAX FLOW APPLICATIONS. Flow graph/networks. Flow constraints 4/30/13. CS lunch today Grading. in-flow = out-flow for every vertex (except s, t)

Discussion Session 2 Constant Acceleration/Relative Motion Week 03

Routing. Elements of packet forwarding (dataplane)

Competitive Routing in the Half-θ 6 -Graph

One-Dimensional Kinematics

Equations of motion for constant acceleration

Matching. Slides designed by Kevin Wayne.

Best test practice: Take the past test on the class website

MAXIMUM FLOW. introduction Ford-Fulkerson algorithm maxflow-mincut theorem

Two Dimensional Dynamics

Two Dimensional Dynamics

Average Case Lower Bounds for Monotone Switching Networks

HYPOTHESIS TESTING. four steps. 1. State the hypothesis and the criterion. 2. Compute the test statistic. 3. Compute the p-value. 4.

Phys 221 Fall Chapter 2. Motion in One Dimension. 2014, 2005 A. Dzyubenko Brooks/Cole

CORRELATION. two variables may be related. SAT scores, GPA hours in therapy, self-esteem grade on homeworks, grade on exams

CS376 Computer Vision Lecture 6: Optical Flow

Network Flows: Introduction & Maximum Flow

COMPETITIVE LOCAL ROUTING WITH CONSTRAINTS

Star coloring of sparse graphs

1 Motivation and Basic Definitions

Ground Rules. PC1221 Fundamentals of Physics I. Kinematics. Position. Lectures 3 and 4 Motion in One Dimension. A/Prof Tay Seng Chuan

Let us start with a two dimensional case. We consider a vector ( x,

Basic Tools CMSC 641. Running Time. Problem. Problem. Algorithmic Design Paradigms. lg (n!) (lg n)! (lg n) lgn n.2

x(m) t(sec ) Homework #2. Ph 231 Introductory Physics, Sp-03 Page 1 of 4

Physics 101: Lecture 03 Kinematics Today s lecture will cover Textbook Sections (and some Ch. 4)

NEWTON S SECOND LAW OF MOTION

homekeeping. simplified

Derivatives of Inverse Trig Functions

Unit 1 Test Review Physics Basics, Movement, and Vectors Chapters 1-3

Flow networks, flow, maximum flow. Some definitions. Edmonton. Saskatoon Winnipeg. Vancouver Regina. Calgary. 12/12 a.

Math 333 Problem Set #2 Solution 14 February 2003

Echocardiography Project and Finite Fourier Series

16 Max-Flow Algorithms

Maximum Flow and Minimum Cut

first-order circuit Complete response can be regarded as the superposition of zero-input response and zero-state response.

Introduction to Congestion Games

6.8 Laplace Transform: General Formulas

CHAPTER THREE MOTION IN A STRAIGHT LINE

Chapter 2 The Derivative Applied Calculus 107. We ll need a rule for finding the derivative of a product so we don t have to multiply everything out.

Chapter 12: Velocity, acceleration, and forces

Physics 240: Worksheet 16 Name


Seminar 4: Hotelling 2

Today s topics. CSE 421 Algorithms. Problem Reduction Examples. Problem Reduction. Undirected Network Flow. Bipartite Matching. Problem Reductions

Energy Problems 9/3/2009. W F d mgh m s 196J 200J. Understanding. Understanding. Understanding. W F d. sin 30

Greedy. I Divide and Conquer. I Dynamic Programming. I Network Flows. Network Flow. I Previous topics: design techniques

CORRELATION. two variables may be related. SAT scores, GPA hours in therapy, self-esteem grade on homeworks, grade on exams

Christos Papadimitriou & Luca Trevisan November 22, 2016

Kinematics in two Dimensions

Key Chemistry 102 Discussion #4, Chapter 11 and 12 Student name TA name Section. ; u= M. and T(red)=2*T(yellow) ; t(yellow)=4*t(red) or

Physics for Scientists and Engineers. Chapter 2 Kinematics in One Dimension

INSTANTANEOUS VELOCITY

24 Single-Source Shortest Paths

Please Complete Course Survey. CMPSCI 311: Introduction to Algorithms. Approximation Algorithms. Coping With NP-Completeness. Greedy Vertex Cover

Transcription:

Warm Up Rn Breadh Fir Search on hi graph aring from. Wha order are erice placed on he qee? When proceing a erex iner neighbor in alphabeical order. In a direced graph, BFS only follow an edge in he direcion i poin. w y x Correc order:,,,y,x,w, bf(graph) ovii.enqee(fir erex) mark fir erex a iied while(ovii i no empy) crren = ovii.deqee() for (V : crren.oneighbor()) if ( i no iied) ovii.enqee() mark a iied finihed.add(crren) CSE 373 SP 8 - KASEY CHAMPION

Shore Pah How doe Google Map figre o hi i he fae way o ge o office hor from Kane? CSE 373 SP 8 - KASEY CHAMPION

Repreening Map a Graph How do we repreen a map a a graph? Wha are he erice and edge? CSE 373 SP 8 - KASEY CHAMPION 3

Repreening Map a Graph K R S H 4 D 4 5 3 P CSE 373 SP 8 - KASEY CHAMPION 4

Shore Pah The lengh of a pah i he m of he edge weigh on ha pah. Shore Pah Problem Gien: a direced graph G and erice and Find: he hore pah from o y 4 5 4 w 3 6 x 5 CSE 373 SP 8 - KASEY CHAMPION 5

Unweighed graph Le ar wih a impler erion: he edge are all he ame weigh (nweighed) If he graph i nweighed, how do we find a hore pah? CSE 373 SP 8 - KASEY CHAMPION 6

Unweighed Graph If he graph i nweighed, how do we find a hore pah? w y x Wha he hore pah from o? - Well.we re already here. Wha he hore pah from o or? - J go on he edge from From o w,x, or y? - Can ge here direcly from, if we wan a lengh pah, hae o go hrogh or. CSE 373 SP 8 - KASEY CHAMPION 7

Unweighed Graph: Key Idea To find he e of erice a diance k, j find he e of erice a diance k-, and ee if any of hem hae an ogoing edge o an ndicoered erex. Do we already know an algorihm ha doe omehing like ha? Ye! BFS! bfshorepah(graph G, erex orce) ovii.enqee(orce) orce.di = 0 mark orce a iied while(ovii i no empy){ crren = ovii.deqee() for ( : crren.oneighbor()){ if ( i no ye iied){.diance = crren.diance +.predeceor = crren ovii.enqee() mark a iied } } } CSE 373 SP 8 - KASEY CHAMPION 8

Unweighed Graph If he graph i nweighed, how do we find a hore pah? bfshorepah(graph G, erex orce) ovii.enqee(orce) orce.di = 0 mark orce a iied while(ovii i no empy){ crren = ovii.deqee() for ( : crren.oneighbor()){ if ( i no ye iied){.diance = crren.diance +.predeceor = crren ovii.enqee() mark a iied } } } w x y 3 CSE 373 SP 8 - KASEY CHAMPION 9

Wha abo he arge erex? Shore Pah Problem Gien: a direced graph G and erice, Find: he hore pah from o. BFS didn menion a arge erex I acally find he hore pah from o eery oher erex. If yo know yor arge, yo can op he algorihm early, when he arge i remoed from he qee. CSE 373 SP 8 - KASEY CHAMPION 0

Weighed Graph Each edge hold repreen he ime or diance from one erex o anoher. Someime hoe aren niform, o we p a weigh on each edge o record ha nmber. The lengh of a pah in a weighed graph i he m of he weigh along ha pah. We ll ame all of he weigh are poiie - For GoogleMap ha definiely make ene. - Someime negaie weigh make ene. Today algorihm doen work for hoe graph - There are oher algorihm ha do work. CSE 373 SP 8 - KASEY CHAMPION

Weighed Graph: Take BFS work if he graph i nweighed. Maybe i j work for weighed graph oo? w x 0 0 0 3 Wha wen wrong? When we fond a horer pah from o, we needed o pdae he diance o (and anyhing whoe hore pah wen hrogh ) b BFS doen do ha. CSE 373 SP 8 - KASEY CHAMPION

Weighed Graph: Take Redcion (informally) Uing an algorihm for Problem B o ole Problem A. Yo already do hi all he ime. In a preio projec, yo redced implemening a hahe o implemening a hahmap. Any ime yo e a library, yo re redcing yor problem o he one he library ole. Can we redce finding hore pah on weighed graph o finding hem on nweighed graph? CSE 373 SP 8 - KASEY CHAMPION 3

Weighed Graph: A Redcion Gien a weighed graph, how do we rn i ino an nweighed one wiho meing p he edge lengh? Tranform Inp Unweighed Shore Pah Tranform Op CSE 373 SP 8 - KASEY CHAMPION 4

Weighed Graph: A Redcion Wha i he rnning ime of or redcion on hi graph? Doe or redcion een work on hi graph? 5000 00 50 5000 0.5 π 3 5000 O( V + E ) of he modified graph, which i low. Ummm. Tl;dr: If yor graph weigh are all mall poiie ineger, hi redcion migh work grea. Oherwie we probably need a new idea. CSE 373 SP 8 - KASEY CHAMPION 5

Weighed Graph: Take 3 So we can j do a redcion. Inead le ry o figre o why BFS worked in he nweighed cae, and ry o make he ame hing happen in he weighed cae. Why did BFS work on nweighed graph? How did we aoid hi problem: w x 0 0 3 When we ed a erex o pdae hore pah we already knew he exac hore pah o. So we neer ran ino he pdae problem So if we proce he erice in order of diance from, we hae a chance. CSE 373 SP 8 - KASEY CHAMPION 6

Weighed Graph: Take 3 Goal: Proce he erice in order of diance from Idea: Hae a e of erice ha are known - (we know a lea one pah from o hem). Record an eimaed diance - (he be way we know o ge o each erex). If we proce only he erex cloe in eimaed diance, we won eer find a horer pah o a proceed erex. CSE 373 SP 8 - KASEY CHAMPION 7