learning objectives learn what graphs are in mathematical terms learn how to represent graphs in computers learn about typical graph algorithms

Similar documents
MAT3707. Tutorial letter 201/1/2017 DISCRETE MATHEMATICS: COMBINATORICS. Semester 1. Department of Mathematical Sciences MAT3707/201/1/2017

CS 241 Analysis of Algorithms

Cycles and Simple Cycles. Paths and Simple Paths. Trees. Problem: There is No Completely Standard Terminology!

16.unified Introduction to Computers and Programming. SOLUTIONS to Examination 4/30/04 9:05am - 10:00am

CSC Design and Analysis of Algorithms. Example: Change-Making Problem

CSE 373: More on graphs; DFS and BFS. Michael Lee Wednesday, Feb 14, 2018

, each of which is a tree, and whose roots r 1. , respectively, are children of r. Data Structures & File Management

Outline. 1 Introduction. 2 Min-Cost Spanning Trees. 4 Example

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

CS 103 BFS Alorithm. Mark Redekopp

Lecture 20: Minimum Spanning Trees (CLRS 23)

Outline. Computer Science 331. Computation of Min-Cost Spanning Trees. Costs of Spanning Trees in Weighted Graphs

CS200: Graphs. Graphs. Directed Graphs. Graphs/Networks Around Us. What can this represent? Sometimes we want to represent directionality:

An undirected graph G = (V, E) V a set of vertices E a set of unordered edges (v,w) where v, w in V

Spanning Trees. BFS, DFS spanning tree Minimum spanning tree. March 28, 2018 Cinda Heeren / Geoffrey Tien 1

Weighted Graphs. Weighted graphs may be either directed or undirected.

(Minimum) Spanning Trees

CS 461, Lecture 17. Today s Outline. Example Run

OpenMx Matrices and Operators

Graphs. Graphs. Graphs: Basic Terminology. Directed Graphs. Dr Papalaskari 1

Round 7: Graphs (part I)

Paths. Connectivity. Euler and Hamilton Paths. Planar graphs.

CSE 373. Graphs 1: Concepts, Depth/Breadth-First Search reading: Weiss Ch. 9. slides created by Marty Stepp

CMPS 2200 Fall Graphs. Carola Wenk. Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk

Grade 7/8 Math Circles March 4/5, Graph Theory I- Solutions

b. How many ternary words of length 23 with eight 0 s, nine 1 s and six 2 s?

CMSC 451: Lecture 2 Graph Basics Thursday, Aug 31, 2017

QUESTIONS BEGIN HERE!

Complete Solutions for MATH 3012 Quiz 2, October 25, 2011, WTT

Graphs. CSC 1300 Discrete Structures Villanova University. Villanova CSC Dr Papalaskari

12/3/12. Outline. Part 10. Graphs. Circuits. Euler paths/circuits. Euler s bridge problem (Bridges of Konigsberg Problem)

5/9/13. Part 10. Graphs. Outline. Circuits. Introduction Terminology Implementing Graphs

Exam 1 Solution. CS 542 Advanced Data Structures and Algorithms 2/14/2013

QUESTIONS BEGIN HERE!

CS61B Lecture #33. Administrivia: Autograder will run this evening. Today s Readings: Graph Structures: DSIJ, Chapter 12

Greedy Algorithms, Activity Selection, Minimum Spanning Trees Scribes: Logan Short (2015), Virginia Date: May 18, 2016

GREEDY TECHNIQUE. Greedy method vs. Dynamic programming method:

CSCI 104 Graph Representation and Traversals. Mark Redekopp David Kempe

Outline. Binary Tree

1 Introduction to Modulo 7 Arithmetic

Depth First Search. Yufei Tao. Department of Computer Science and Engineering Chinese University of Hong Kong

Math 61 : Discrete Structures Final Exam Instructor: Ciprian Manolescu. You have 180 minutes.

Module graph.py. 1 Introduction. 2 Graph basics. 3 Module graph.py. 3.1 Objects. CS 231 Naomi Nishimura

Theorem 1. An undirected graph is a tree if and only if there is a unique simple path between any two of its vertices.

5/1/2018. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees

5/7/13. Part 10. Graphs. Theorem Theorem Graphs Describing Precedence. Outline. Theorem 10-1: The Handshaking Theorem

Applications: The problem has several applications, for example, to compute periods of maximum net expenses for a design department.

Constructive Geometric Constraint Solving

The University of Sydney MATH 2009

Outline. Circuits. Euler paths/circuits 4/25/12. Part 10. Graphs. Euler s bridge problem (Bridges of Konigsberg Problem)

Solutions to Homework 5

COMP 250. Lecture 29. graph traversal. Nov. 15/16, 2017

0.1. Exercise 1: the distances between four points in a graph

d e c b a d c b a d e c b a a c a d c c e b

Improving Union. Implementation. Union-by-size Code. Union-by-Size Find Analysis. Path Compression! Improving Find find(e)

N=4 L=4. Our first non-linear data structure! A graph G consists of two sets G = {V, E} A set of V vertices, or nodes f

Designing A Concrete Arch Bridge

Graph Search (6A) Young Won Lim 5/18/18

Algorithmic and NP-Completeness Aspects of a Total Lict Domination Number of a Graph

Present state Next state Q + M N

Divided. diamonds. Mimic the look of facets in a bracelet that s deceptively deep RIGHT-ANGLE WEAVE. designed by Peggy Brinkman Matteliano

ECE 407 Computer Aided Design for Electronic Systems. Circuit Modeling and Basic Graph Concepts/Algorithms. Instructor: Maria K. Michael.

10/30/12. Today. CS/ENGRD 2110 Object- Oriented Programming and Data Structures Fall 2012 Doug James. DFS algorithm. Reachability Algorithms

Problem solving by search

CS September 2018

EE1000 Project 4 Digital Volt Meter

Graph Algorithms and Combinatorial Optimization Presenters: Benjamin Ferrell and K. Alex Mills May 7th, 2014

Announcements. Not graphs. These are Graphs. Applications of Graphs. Graph Definitions. Graphs & Graph Algorithms. A6 released today: Risk

4.1 Interval Scheduling. Chapter 4. Greedy Algorithms. Interval Scheduling: Greedy Algorithms. Interval Scheduling. Interval scheduling.

Section 10.4 Connectivity (up to paths and isomorphism, not including)

Revisiting Decomposition Analysis of Geometric Constraint Graphs

Graph Isomorphism. Graphs - II. Cayley s Formula. Planar Graphs. Outline. Is K 5 planar? The number of labeled trees on n nodes is n n-2

Strongly connected components. Finding strongly-connected components

(4, 2)-choosability of planar graphs with forbidden structures

CS150 Sp 98 R. Newton & K. Pister 1

COMP108 Algorithmic Foundations

Indices. Indices. Curriculum Ready ACMNA: 209, 210, 212,

Solutions for HW11. Exercise 34. (a) Use the recurrence relation t(g) = t(g e) + t(g/e) to count the number of spanning trees of v 1

(2) If we multiplied a row of B by λ, then the value is also multiplied by λ(here lambda could be 0). namely

Why the Junction Tree Algorithm? The Junction Tree Algorithm. Clique Potential Representation. Overview. Chris Williams 1.

BASIC CAGE DETAILS SHOWN 3D MODEL: PSM ASY INNER WALL TABS ARE COINED OVER BASE AND COVER FOR RIGIDITY SPRING FINGERS CLOSED TOP

Similarity Search. The Binary Branch Distance. Nikolaus Augsten.

1. Determine whether or not the following binary relations are equivalence relations. Be sure to justify your answers.

Graphs and Graph Searches

ECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS

The University of Sydney MATH2969/2069. Graph Theory Tutorial 5 (Week 12) Solutions 2008

Minimum Spanning Trees

Numbering Boundary Nodes

Trees as operads. Lecture A formalism of trees

More Foundations. Undirected Graphs. Degree. A Theorem. Graphs, Products, & Relations

BASIC CAGE DETAILS D C SHOWN CLOSED TOP SPRING FINGERS INNER WALL TABS ARE COINED OVER BASE AND COVER FOR RIGIDITY

Seven-Segment Display Driver

Tangram Fractions Overview: Students will analyze standard and nonstandard

MCS100. One can begin to reason only when a clear picture has been formed in the imagination.

Outlines: Graphs Part-4. Applications of Depth-First Search. Directed Acyclic Graph (DAG) Generic scheduling problem.

Math 166 Week in Review 2 Sections 1.1b, 1.2, 1.3, & 1.4

Minimum Spanning Trees

Planar Upward Drawings

Designing A Uniformly Loaded Arch Or Cable

Transcription:

rp loritms

lrnin ojtivs loritms your sotwr systm sotwr rwr lrn wt rps r in mtmtil trms lrn ow to rprsnt rps in omputrs lrn out typil rp loritms

wy rps? intuitivly, rp is orm y vrtis n s twn vrtis rps r us in numrous ils to mol rltionsips (s) twn lmnts (vrtis) in lyrs input lyrs output lyrs 0 6 6

wt s rp? ormlly, rp is tupl G = (V,E) o sts, wr V is st o vrtis (or nos or points) n E is st o s su tt: xmpl: E V V V = {,,,,, 6, } 6 E = {{, }, {, }, {}, {, }, {, }, {, }, {, }}

typs o rps unirt: V = {,,,,, 6, } E = {{, }, {, }, {}, {, }, {, }, {, }, {, }} 6 irt: E = {(, ), (, ), (, ), (, ), (, ), (, ), (, ), (, )} x orint: 6 x E = {(, ), (, ), (, ), (, ), (, ), (, ), (, ), (, )}

nottions & mtris lt G rp, G.V nots its st o vrtis n G.E its st o s t twn vrtis x n y is not {x,y}, (x,y) or simply xy t orr o G, writtn G, is t numr o its vrtis, wrs G nots its numr o s rp G is sprs i G G n it is ns i G G two vrtis x n y r jnt or niors i xy G i ll t vrtis o G r pirwis jnt, tn G is omplt

nottions & mtris pt rom vrtx x to vrtx y is squn v0, v,..., vk o vrtis vi V wr x = v0 n y = vk, su tt i {,..., k} : (vi, vi) E rp is onnt i vry pir o vrtis is onnt vi pt pt v0, v,..., vk is yl i vrtis v0 = vk w n stor ttriuts in vrtis n s usin t ott nottion,.., v.olor stors olor ttriut in vrtx v, wil.wit n (x,y).wit stor wit ttriut in n (x,y) rsptivly

nottions & mtris lt G = (V,E) n Gʹ = (Vʹ,Eʹ) two rps, i Vʹ V n Eʹ E, tn Gʹ is surp o G, wi w writ Gʹ G lt G = (V,E) n Gʹ = (Vʹ,Eʹ) two rps n Gʹ G, i Vʹ = V, Gʹ is spnnin surp o G t r (or vlny) o vrtx v is t numr o niors o v n is not (v) w in!(g) = min { (v) v V } s t minimum r o G w in Δ(G) = mx { (v) v V } s t mximum r o G V X w in (G) = s t vr r o G vv (v)

rprsntin rps irt 6 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 6 jny mtrix jny list n jny list is st suit or rprsntin sprs rp most rp loritms rly on jny lists n jny mtrix is st suit or rprsntin ns rp or wn t loritm ns to know quikly i tr xists n onntin two vrtis

rprsntin rps unirt 6 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 6 jny list jny mtrix

typil prolms rt-irst sr minimum spnnin tr sinl-sour sortst pts

rt-irst sr ivn rp G n sour vrtx s G, it isovr vry vrtx rl rom s it omputs t istn rom s to vry vrtx v G it prous rt-irst tr root t s tt ontins ll rl vrtis rom s t sr is si to rt-irst us it isovrs ll vrtis t istn k rom s or isovrin ny vrtis t istn k +

rt-irst sr s

rt-irst sr s

rt-irst sr s

rt-irst sr () () () () (i) rom: r s t u 0 v w x y Introution to Aloritms y T. H. Cormn t l. r Eition MIT Prss, 00 Q s 0 r s t u r s 0 v w x y r t u v w x y r s 0 t u v w x y r s 0 s 0 t u v w x y Q Q Q Q r x u ; t v y x u () () () () r s t u 0 v w x y t u 0 v w x y r s 0 t u v w x y r s 0 t u v w x y Q Q Q Q w t v y r x u v y BFS.G; s/ or vrtx u G:V s u:olor D WHITE u: D u: D NIL s:olor D GRAY 6 s: D 0 s: D NIL Q D; ENQUEUE.Q; s/ 0 wil Q ; u D DEQUEUE.Q/ or G:AjŒu i :olor == WHITE :olor D GRAY : D u: C 6 : D u ENQUEUE.Q; / u:olor D BLACK Fiur. illustrts t prorss o B v. istn rom sour s wit : unisovr v.olor ry : isovr wit som niors isovr lk : isovr wit ll niors isovr v.π prssor in r-irst tr

minimum spnnin tr 6 0 wit rp Gw = (G,w) is tupl ompos o rp G = (V,E) n o untion w : E R ssoitin wit w to E minimum (wit) spnnin tr o rp Gw = (G,w) is onnt surp (Vʹ,Eʹ) su tt: ❷ ❶ Vʹ = V (Vʹ,Eʹ) os not ontin ny yls ❸ X w is miniml ross ll surps ulillin ❶ n ❷ E 0

minimum spnnin tr isjoint-st t strutur mintins olltion " = {S,S,...,Sk} o isjoint ynmi sts wr st is intii y mmr o t st known s its rprsnttiv isjoint-st t strutur supports t ollowin oprtions: MAKE-SET(x) rts nw st wos only mmr n its rprsnttiv is x UNION(x,y) mrs t ynmi sts tt ontin x n y, sy Sx n Sy, into nw st tt is t union o ts two sts FIND-SET(x) rturns t rprsnttiv o t st ontinin x

minimum spnnin tr 6 Cptr Minimum Spnnin Trs () MST-KRUSKAL.G; w/ Kruskl s loritm A D; or i vrtx G:V () i MAKE-SET./ 0 0 sort t s o G:E into nonrsin orry wit w or.u; / G:E,tkninnonrsinorrywit 6 i FIND-SET.u/ FIND-SET./ A D A [.u; / i i i UNION.u; / () i 6 () () i i 6 rturn A 0 0 0 6 Cptr Minimum Spnnin Trs () () () () () () () () 0 0 Fiur. sows ow Kruskl s loritm works. Lins initiliz t i i i 66 () () () 0 0 0 0 i i i 6 0 0 0 0 0 () () () i i i 0 0 0 () () () () i i i 66 0 0 0 0 () () () i i i 6 0 0 0 () i 0 rom: () () () Introution to Aloritms Fiur. Txution o Kruskl s loritm on t rp rom Fiur.. S s y T. H. Cormn t l. lon to t orst A in rown. T loritm onsirs in sort orr y wit. r Eition An rrow i points to t unr onsirtion t stp o t loritm. I t joins two MIT Prss, 00 istint i trs int orst, it is to t orst, () () try mrin it i two trs.

MST-KRUSKAL.G; w/ minimum spnnin tr A D; or vrtx G:V MAKE-SET./ sort t s o G:E into nonrsin orr y wit w or.u; / G:E,tkninnonrsinorrywit 6 i FIND-SET.u/ FIND-SET./ A D A [.u; / UNION.u; / rturn A Kruskl s loritm Fiur. sows ow Kruskl s loritm works. Lins initiliz t (i) i 0 (j) i 0 (k) i 0 (l) i 0 rom: Introution to Aloritms y T. H. Cormn t l. r Eition MIT Prss, 00 (m) i 0 (n) i 0

MST-KRUSKAL.G; w/ minimum spnnin tr A D; or vrtx G:V MAKE-SET./ sort t s o G:E into nonrsin orr y wit w or.u; / G:E,tkninnonrsinorrywit 6 i FIND-SET.u/ FIND-SET./ A D A [.u; / UNION.u; / rturn A Kruskl s loritm Fiur. sows ow Kruskl s loritm works. Lins initiliz t i 0 t Kruskl s loritm is ry, i.., it mks lolly optiml oi t stp rom: Introution to Aloritms y T. H. Cormn t l. r Eition MIT Prss, 00