Lesson 5.5. Minimum Spanning Trees. Explore This

Size: px
Start display at page:

Download "Lesson 5.5. Minimum Spanning Trees. Explore This"

Transcription

1 Lesson. St harles ounty Minimum Spanning Trees s in many of the previous lessons, this lesson focuses on optimization. Problems and applications here center on two types of problems: finding ways of connecting the vertices of a graph with the least number of edges and finding ways of connecting them with the least number of edges that have the smallest total weight. xplore This n making earthquake preparedness plans, the St. harles ounty government needs a design for repairing the county roads in case of an emergency. igure.1 is a map of the towns in the county and the existing major roads between them. evise a plan that repairs the least number of roads but keeps a route open between each pair of towns. igure.1. The towns in St. harles ounty. Wentzville O'allon Peruque Orchard arm St. Peters St. harles New Melle arvester ugusta

2 hapter More raphs, Subgraphs, and Trees xamine your graph. f it connects each of the towns (vertices) and has no cycles, you ve found a spanning tree. spanning tree of a connected graph is a tree that is a subgraph of and contains every vertex of. spanning tree of the graph in igure.1 would model the minimum number of roads (edges) needed to connect each town in case of an emergency. ompare your plan with the other plans developed in your class. They should all contain the same number of edges but not necessarily the same edges. t is possible for a graph to have many different spanning trees. nd as you may have guessed, for a graph that is not connected, no spanning tree is possible. One systematic way to find a spanning tree for a graph is to delete an edge from each cycle in the graph. Unfortunately, this is not an easy procedure for a very large graph. ut there are other ways of finding a spanning tree for a graph if one exists. One such method that can be easily adapted to computers is called the breadth-first search algorithm. readth-irst Search lgorithm for inding Spanning Trees 1. Pick a starting vertex, S, and label it with a 0.. ind all vertices that are adjacent to S and label them with a 1.. or each vertex labeled with a 1, find an edge that connects it with the vertex labeled 0. arken those edges.. Look for unlabeled vertices adjacent to those with the label 1 and label them. or each vertex labeled, find an edge that connects it with a vertex labeled 1. arken that edge. f more than one edge exists, choose one arbitrarily.. ontinue this process until there are no more unlabeled vertices adjacent to labeled ones. f not all vertices of the graph are labeled, then a spanning tree for the graph does not exist. f all vertices are labeled, the vertices and darkened edges are a spanning tree of the graph.

3 Lesson. Minimum Spanning Trees xample Use the breadth-first search algorithm to find a spanning tree for the following graph. J Solution: s shown in the following figure, the algorithm begins by picking a starting vertex, calling it S, and labeling it with a 0. The labeling and darkening of edges then proceed according to steps through of the algorithm. s you probably noticed, this is not a unique solution. t is just one of the graph s many spanning trees. 1 S 0 1 J

4 hapter More raphs, Subgraphs, and Trees Many applications are best modeled with weighted graphs. When this is the case, it is often not sufficient to find just any spanning tree, but to find one with minimal or maximal weight. Return to the earthquake preparedness situation and reconsider the problem when distances between towns are added to the graph (see igure.1). Wentzville 10 1 New Melle O'allon Peruque St. Peters ugusta igure.1. Map of St. harles ounty with mileage shown. Orchard arm St. harles arvester Refer back to your solution of the original problem and find the total number of miles of road that would need to be repaired if your plan were implemented. ompare your plan with others in your class. Which plan or plans yield the minimum number of miles? Wentzville New Melle 1 O'allon igure.1. Spanning tree of minimum weight for the towns in St. harles ounty. or this particular problem, the minimum possible number of miles of road is. spanning tree with that total weight is shown in igure.1. spanning tree of minimal weight is called a minimum spanning tree. One algorithm for finding a minimum spanning tree for a graph is known as Kruskal s algorithm. t was developed in 1 and named after its designer, Joseph. Kruskal, a leading mathematician at ell Laboratories. 1 Peruque St. Peters ugusta 1 Orchard arm St. harles arvester

5 Lesson. Minimum Spanning Trees xample Use Kruskal s algorithm to find a minimum spanning tree for the following graph. Solution: There are five vertices in the graph, so four edges must be chosen. List the edges from shortest to longest. irst on the list is (). arken it. Then darken (). The next shortest edge is, but if picked, it will form a cycle. So pick (). or the last edge there are two edges of length. ither or can be darkened. The darkened edges of the following graph form one of the minimum spanning trees of the graph. t has a minimal weight of =. 10 Kruskal s Minimum Spanning Tree lgorithm 1. xamine the graph. f it is not connected, there will be no minimum spanning tree.. List the edges in order from shortest to longest. Ties are broken arbitrarily.. arken the first edge on the list.. Select the next edge on the list. f it does not form a cycle with the darkened edges, darken it.. or a graph with n vertices, continue step until n 1 edges of the graph have been darkened. The vertices and the darkened edges are a minimum spanning tree for the graph. Notice that both Kruskal s and ijkstra s (Lesson.) algorithms produce spanning trees. ut unlike ijkstra s 10 shortest path algorithm, which gives you a spanning tree of shortest paths, Kruskal s algorithm yields a spanning tree of minimal total weight. List of dges from Shortest to Longest dge Length

6 hapter More raphs, Subgraphs, and Trees xercises n xercises 1 through, find a spanning tree for each graph if one exists raw a spanning tree for a K graph.

7 Lesson. Minimum Spanning Trees. K L J Sid began using the breadth-first search algorithm to try to find a spanning tree for the preceding graph. e began with vertex, labeled it with a 0, and labeled and with 1s. e then darkened edges and, looked for vertices adjacent to the 1s, and selected vertex. e labeled it with a and darkened edge. 1 0 K L 1 J a. ould Sid have darkened instead of? opy Sid s graph and complete the search for Sid by answering the following questions. b. Which vertices receive s for labels? Label these vertices. c. Which edges subsequently are darkened? arken these edges. d. Three vertices should be labeled. Which ones? Label these vertices and 1 darken the appropriate 0 edges. Your graph could K look like the one at right. L ontinue the algorithm until all vertices are labeled. J heck your darkened edges 1 to make sure they form a spanning tree.

8 0 hapter More raphs, Subgraphs, and Trees. Use the breadth-first search algorithm to find a spanning tree for this graph. egin at vertex. J. Use mathematical induction on the number of edges to prove that every connected graph has a spanning tree. 10. The breadth-first search algorithm can be applied to digraphs if slight changes are made. Modify the algorithm on page so that it can be used with digraphs. pply your modified breadth-first search algorithm to the following digraph. Use Kruskal s algorithm to find a minimum spanning tree for the graphs in xercises 11 through 1. What is the minimal weight in each case?

9 Lesson. Minimum Spanning Trees 1 1. J K L M N The computers in each of the offices at Pattonville igh School need to be linked by cable. The following map shows the cost of each link in hundreds of dollars. What is the minimum cost of linking the five offices? Suppose that the cable in xercise 1 was installed by a disreputable firm that used only the most expensive links. What would be the maximum cost for the four links? 1. ow might Kruskal s minimum spanning tree algorithm be modified to make it a maximum spanning tree algorithm?

10 hapter More raphs, Subgraphs, and Trees nother algorithm that can be used to find a minimum spanning tree is attributed to R.. Prim, a mathematician at the Mathematics enter at ell Labs. Prim s Minimum Spanning Tree lgorithm 1. ind the shortest edge of the graph. arken it and circle its two vertices. Ties are broken arbitrarily.. ind the shortest remaining undarkened edge having one circled vertex and one uncircled vertex. arken this edge and circle its uncircled vertex.. Repeat step until all vertices are circled. 1. Use Prim s algorithm to find a minimum spanning tree for the following graph. What is the minimal weight? 1. Use Prim s algorithm to find a minimum spanning tree for the following graph. What is the minimal weight?

11 Lesson. Minimum Spanning Trees 0. When the shortest path algorithm from Lesson. is applied until all vertices of a graph are used, it yields a spanning tree of the graph. s it always a minimum spanning tree? heck your answer to this question by doing the following. a. ind a minimum spanning tree of the graph above using either Kruskal s or Prim s algorithm. What is the total weight of the minimum spanning tree? b. ind the shortest route from to each of the other vertices using the shortest path algorithm (page ). ive the lengths of each of these routes. c. s the shortest route tree from to each of the other vertices a minimum spanning tree of this graph? xplain why or why not. 1. Traveling salesperson problems, shortest route problems, and minimum spanning tree problems are often confused because each type of problem can be solved by finding a subgraph that includes all of the vertices of the graph. ompare and contrast what each type of problem asks and when each type of problem is used. Project. n this lesson, you have applied two of the three classical minimum spanning tree algorithms, Kruskal s and Prim s. The third algorithm of this group was designed by O. orůvka. nvestigate orůvka s algorithm, learn to apply it, and report on how it differs from Kruskal s and Prim s algorithms.

12 hapter More raphs, Subgraphs, and Trees Splitting Terrorist ells Science News Online ow can you tell if enough members of a terrorist cell have been captured or killed so there s a high probability that the cell can no longer carry out an attack? mathematical model of terrorist organizations might provide some clues. The question is what sort of mathematical model would work best. One way to describe a terrorist organization is in terms of a graph. n this model, each node would represent an individual member of a given cell, and a line linking two nodes would indicate direct communication between those two members. n this hypothetical four-member cell, represented by a graph, oromir, eleborn, and oromir enethor communicate directly with each other, but ragorn communicates only with oromir. When a cell ragorn eleborn enethor member is removed, the corresponding node is deleted from the graph. eleting enough nodes leads to disruption. Mathematically, you could ask the question: ow many nodes must you remove from a given graph before it splits into two or more separate pieces? n this seven-member cell, removing would have little effect on the organization. Removing and instead would split the cell into two units that presumably would be less effective on their own. graph model, however, may not be the best one available for representing a typical terrorist organization, mathematician Jonathan. arley of the Massachusetts nstitute of Technology contends. arley has proposed an alternative approach that reflects an organization s hierarchy. My method uses order theory to quantify the degree to which a terrorist network is still able to function, he says. n this case, the relationship of one individual to another in a cell becomes important. Leaders are represented by the topmost nodes in a diagram of the ordered set representing a cell and foot soldiers are nodes at the bottom. isrupting the organization would be equivalent to disrupting the chain of command, which allows orders to pass from leaders to foot soldiers. n this ordered-set representation of a terrorist cell, points represent individual members and lines show communication links. Members,, and are leaders and rank higher than all other members., J, and K have the lowest rank. given ordered set may have several such chains of command that link a leader with a foot soldier. ll of these chains must be broken for a cell (or remnant) to be considered ineffective. arley s model has several shortcomings. Law enforcement often doesn t know how a terrorist cell is organized or even its full membership. Nonetheless, arley contends, this model enables law enforcement to plan its operations in less of an ad hoc fashion than they might be able to do otherwise. J K

Lesson 4.2. Critical Paths

Lesson 4.2. Critical Paths Lesson. ritical Paths It is relatively easy to find the shortest time needed to complete a project if the project consists of only a few activities. ut as the tasks increase in number, the problem becomes

More information

CAD Algorithms. Shortest Path

CAD Algorithms. Shortest Path lgorithms Shortest Path lgorithms Mohammad Tehranipoor epartment September 00 Shortest Path Problem: ind the best way of getting from s to t where s and t are vertices in a graph. est: Min (sum of the

More information

CS1800: Graph Algorithms (2nd Part) Professor Kevin Gold

CS1800: Graph Algorithms (2nd Part) Professor Kevin Gold S1800: raph lgorithms (2nd Part) Professor Kevin old Summary So ar readth-irst Search (S) and epth-irst Search (S) are two efficient algorithms for finding paths on graphs. S also finds the shortest path.

More information

Minimum Spanning Trees and Shortest Paths

Minimum Spanning Trees and Shortest Paths Minimum Spanning Trees and Shortest Paths Prim's algorithm ijkstra's algorithm November, 017 inda eeren / eoffrey Tien 1 Recall: S spanning tree Starting from vertex 16 9 1 6 10 13 4 3 17 5 11 7 16 13

More information

A region is each individual area or separate piece of the plane that is divided up by the network.

A region is each individual area or separate piece of the plane that is divided up by the network. Math 135 Networks and graphs Key terms Vertex (Vertices) ach point of a graph dge n edge is a segment that connects two vertices. Region region is each individual area or separate piece of the plane that

More information

Minimum Spanning Trees and Shortest Paths

Minimum Spanning Trees and Shortest Paths Minimum Spanning Trees and Shortest Paths Kruskal's lgorithm Prim's lgorithm Shortest Paths pril 04, 018 inda eeren / eoffrey Tien 1 Kruskal's algorithm ata types for implementation Kruskalslgorithm()

More information

Spanning Tree. Lecture19: Graph III. Minimum Spanning Tree (MSP)

Spanning Tree. Lecture19: Graph III. Minimum Spanning Tree (MSP) Spanning Tree (015) Lecture1: Graph III ohyung Han S, POSTH bhhan@postech.ac.kr efinition and property Subgraph that contains all vertices of the original graph and is a tree Often, a graph has many different

More information

Lecture 13: Weighted Shortest Paths. These slides include material originally prepared by Dr. Ron Cytron and Dr. Steve Cole.

Lecture 13: Weighted Shortest Paths. These slides include material originally prepared by Dr. Ron Cytron and Dr. Steve Cole. Lecture : Weighted Shortest Paths These slides include material originally prepared by r. Ron ytron and r. Steve ole. nnouncements Lab code and post-lab due tonight Lab released tomorrow ijkstra s algorithm

More information

An Early Problem in Graph Theory. Clicker Question 1. Konigsberg and the River Pregel

An Early Problem in Graph Theory. Clicker Question 1. Konigsberg and the River Pregel raphs Topic " Hopefully, you've played around a bit with The Oracle of acon at Virginia and discovered how few steps are necessary to link just about anybody who has ever been in a movie to Kevin acon,

More information

SAMPLE. MODULE 5 Undirected graphs

SAMPLE. MODULE 5 Undirected graphs H P T R MOUL Undirected graphs How do we represent a graph by a diagram and by a matrix representation? How do we define each of the following: graph subgraph vertex edge (node) loop isolated vertex bipartite

More information

Spanning Trees. CSE373: Data Structures & Algorithms Lecture 17: Minimum Spanning Trees. Motivation. Observations. Spanning tree via DFS

Spanning Trees. CSE373: Data Structures & Algorithms Lecture 17: Minimum Spanning Trees. Motivation. Observations. Spanning tree via DFS Spanning Trees S: ata Structures & lgorithms Lecture : Minimum Spanning Trees simple problem: iven a connected undirected graph =(V,), find a minimal subset of edges such that is still connected graph

More information

These definitions cover some basic terms and concepts of graph theory and how they have been implemented as C++ classes.

These definitions cover some basic terms and concepts of graph theory and how they have been implemented as C++ classes. hapter 5. raph Theory *raph Theory, *Mathematics raph theory is an area of mathematics which has been incorporated into IS to solve some specific problems in oolean operations and sweeping. It may be also

More information

Minimum spanning trees

Minimum spanning trees Carlos Moreno cmoreno @ uwaterloo.ca EI-3 https://ece.uwaterloo.ca/~cmoreno/ece5 Standard reminder to set phones to silent/vibrate mode, please! During today's lesson: Introduce the notion of spanning

More information

the Further Mathematics network V SUMMARY SHEET DECISION MATHS Algorithms Input A and B (positive integers)

the Further Mathematics network  V SUMMARY SHEET DECISION MATHS Algorithms Input A and B (positive integers) the urther Mathematics network www.fmnetwork.org.uk V 07 SUMMRY SHT ISION MTHS lgorithms The main ideas are covered in Q dexcel MI OR The main ideas in this topic are Understanding and implementing a variety

More information

TCOM 501: Networking Theory & Fundamentals. Lecture 11 April 16, 2003 Prof. Yannis A. Korilis

TCOM 501: Networking Theory & Fundamentals. Lecture 11 April 16, 2003 Prof. Yannis A. Korilis TOM 50: Networking Theory & undamentals Lecture pril 6, 2003 Prof. Yannis. Korilis 2 Topics Routing in ata Network Graph Representation of a Network Undirected Graphs Spanning Trees and Minimum Weight

More information

PhysicsAndMathsTutor.com

PhysicsAndMathsTutor.com 1. The network in the diagram above shows the distances, in metres, between 10 wildlife observation points. The observation points are to be linked by footpaths, to form a network along the arcs indicated,

More information

Honors ICM- Graph Theory Unit 7 Homework Packet Homework Day 1

Honors ICM- Graph Theory Unit 7 Homework Packet Homework Day 1 Honors ICM- Graph Theory Unit 7 Homework Packet Homework Day 1 Name Period: 6. Construct a graph with three critical paths. 7. Determine the minimum project time and the critical path for the following

More information

Analysis of Algorithms Prof. Karen Daniels

Analysis of Algorithms Prof. Karen Daniels UMass Lowell omputer Science 91.404 nalysis of lgorithms Prof. Karen aniels Spring, 2013 hapter 22: raph lgorithms & rief Introduction to Shortest Paths [Source: ormen et al. textbook except where noted]

More information

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 3 Definitions an undirected graph G = (V, E)

More information

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions Introduction Chapter 9 Graph Algorithms graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 2 Definitions an undirected graph G = (V, E) is

More information

SEVENTH EDITION and EXPANDED SEVENTH EDITION

SEVENTH EDITION and EXPANDED SEVENTH EDITION SEVENTH EDITION and EXPANDED SEVENTH EDITION Slide 14-1 Chapter 14 Graph Theory 14.1 Graphs, Paths and Circuits Definitions A graph is a finite set of points called vertices (singular form is vertex) connected

More information

Introduction to Graphs. common/notes/ppt/

Introduction to Graphs.   common/notes/ppt/ Introduction to Graphs http://people.cs.clemson.edu/~pargas/courses/cs212/ common/notes/ppt/ Introduction Graphs are a generalization of trees Nodes or verticies Edges or arcs Two kinds of graphs irected

More information

An Algorithmic Approach to Graph Theory Neetu Rawat

An Algorithmic Approach to Graph Theory Neetu Rawat An Algorithmic Approach to Graph Theory Neetu Rawat nrwt12345@gmail.com, Assistant Professor, Chameli Devi Group of Institutions, Indore. India. Abstract This paper compares two different minimum spanning

More information

Routing. Effect of Routing in Flow Control. Relevant Graph Terms. Effect of Routing Path on Flow Control. Effect of Routing Path on Flow Control

Routing. Effect of Routing in Flow Control. Relevant Graph Terms. Effect of Routing Path on Flow Control. Effect of Routing Path on Flow Control Routing Third Topic of the course Read chapter of the text Read chapter of the reference Main functions of routing system Selection of routes between the origin/source-destination pairs nsure that the

More information

Key Concept Congruent Figures

Key Concept Congruent Figures 4-1 ongruent igures ommon ore State Standards Prepares for G-SRT..5 Use congruence... criteria for triangles to solve problems and prove relationships in geometric figures. P 1, P 3, P 4, P 7 Objective

More information

Undirected graphs and networks

Undirected graphs and networks Gen. Maths h. 1(1) Page 1 Thursday, ecember 0, 1999 1:10 PM Undirected graphs and networks 1 V co covverage rea of study Units 1 & Geometry In this chapter 1 Vertices and edges 1 Planar graphs 1 ulerian

More information

An Early Problem in Graph Theory

An Early Problem in Graph Theory raphs Topic 2 " Hopefully, you've played around a bit with The Oracle of acon at Virginia and discovered how few steps are necessary to link just about anybody who has ever been in a movie to Kevin acon,

More information

Graph Theory Notes Dayna B. Smithers

Graph Theory Notes Dayna B. Smithers Graph Theory Notes Dayna B. Smithers 3 GRAPH THEORY INTRODUCTION UNIT 3.1 Introduction A graph G is a finite nonempty set of objects called vertices together with a set of unordered pairs of distinct vertices

More information

CSE 332: Data Structures & Parallelism Lecture 22: Minimum Spanning Trees. Ruth Anderson Winter 2018

CSE 332: Data Structures & Parallelism Lecture 22: Minimum Spanning Trees. Ruth Anderson Winter 2018 SE 33: Data Structures & Parallelism Lecture : Minimum Spanning Trees Ruth nderson Winter 08 Minimum Spanning Trees iven an undirected graph =(V,E), find a graph =(V, E ) such that: E is a subset of E

More information

10/30/2013. Chapter 7: The Mathematics of Networks. Network. Network. Network. Network. Optimal Network. 7.1 Networks and Trees

10/30/2013. Chapter 7: The Mathematics of Networks. Network. Network. Network. Network. Optimal Network. 7.1 Networks and Trees Network Chapter 7: The Mathematics of Networks Our definition of a network is going to be really simple essentially, a network is a graph that is connected. In this context the term is most commonly used

More information

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be if not careful with data structures 3 Definitions an undirected graph G = (V, E) is a

More information

SUMMARY SHEET DECISION MATHS. Algorithms. Input A and B (positive integers) Let Q = int(b/a) Let R1 = B A Q

SUMMARY SHEET DECISION MATHS. Algorithms. Input A and B (positive integers) Let Q = int(b/a) Let R1 = B A Q the urther Mathematics network www.fmnetwork.org.uk V 07 SUMMRY SHT ISION MTHS lgorithms The main ideas are covered in Q dexcel MI OR The main ideas in this topic are Understanding and implementing a variety

More information

Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret

Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret Greedy Algorithms (continued) The best known application where the greedy algorithm is optimal is surely

More information

A graph is a set of objects (called vertices or nodes) and edges between pairs of nodes.

A graph is a set of objects (called vertices or nodes) and edges between pairs of nodes. Section 1.4: raphs and Trees graph is a set of objects (called vertices or nodes) and edges between pairs of nodes. Eq Co Ve Br S Pe Bo Pa U Ch Vertices = {Ve,, S,, Br, Co, Eq, Pe, Bo,Pa, Ch,, U} Edges

More information

Graphs: Topological Sort / Graph Traversals (Chapter 9)

Graphs: Topological Sort / Graph Traversals (Chapter 9) Today s Outline raphs: Topological Sort / raph Traversals (hapter 9) S 373 ata Structures and lgorithms dmin: omework #4 - due Thurs, Nov 8 th at pm Midterm 2, ri Nov 6 raphs Representations Topological

More information

TA: Jade Cheng ICS 241 Recitation Lecture Notes #12 November 13, 2009

TA: Jade Cheng ICS 241 Recitation Lecture Notes #12 November 13, 2009 TA: Jade Cheng ICS 241 Recitation Lecture Notes #12 November 13, 2009 Recitation #12 Question: Use Prim s algorithm to find a minimum spanning tree for the given weighted graph. Step 1. Start from the

More information

CS 5114: Theory of Algorithms. Graph Algorithms. A Tree Proof. Graph Traversals. Clifford A. Shaffer. Spring 2014

CS 5114: Theory of Algorithms. Graph Algorithms. A Tree Proof. Graph Traversals. Clifford A. Shaffer. Spring 2014 epartment of omputer Science Virginia Tech lacksburg, Virginia opyright c 04 by lifford. Shaffer : Theory of lgorithms Title page : Theory of lgorithms lifford. Shaffer Spring 04 lifford. Shaffer epartment

More information

Exam 3 Practice Problems

Exam 3 Practice Problems Exam 3 Practice Problems HONOR CODE: You are allowed to work in groups on these problems, and also to talk to the TAs (the TAs have not seen these problems before and they do not know the solutions but

More information

Single Source, Shortest Path Problem

Single Source, Shortest Path Problem Lecture : From ijkstra to Prim Today s Topics: ijkstra s Shortest Path lgorithm epth First Search Spanning Trees Minimum Spanning Trees Prim s lgorithm overed in hapter 9 in the textbook Some slides based

More information

CAD Algorithms. Categorizing Algorithms

CAD Algorithms. Categorizing Algorithms CAD Algorithms Categorizing Algorithms Mohammad Tehranipoor ECE Department 2 September 2008 1 Categorizing Algorithms Greedy Algorithms Prim s Algorithm (Minimum Spanning Tree) A subgraph that is a tree

More information

Spanning Trees. Lecture 20 CS2110 Spring 2015

Spanning Trees. Lecture 20 CS2110 Spring 2015 1 Spanning Trees Lecture 0 CS110 Spring 01 1 Undirected trees An undirected graph is a tree if there is exactly one simple path between any pair of vertices Root of tree? It doesn t matter choose any vertex

More information

Chapter 4 Review. 1. Write a summary of what you think are the important points of this chapter. 2. Draw a graph for the following task table.

Chapter 4 Review. 1. Write a summary of what you think are the important points of this chapter. 2. Draw a graph for the following task table. hapter Review 1. Write a summary of what you think are the important points of this chapter.. raw a graph for the following task table. Task Time Prerequisites Start 0 None 1 5,, I, inish. a. List the

More information

What Time Where Muddy City 10 min MSTLessonPlan.docx MSTWorksheets.pptx Discussion 5 min MSTLessonPlan.docx

What Time Where Muddy City 10 min MSTLessonPlan.docx MSTWorksheets.pptx Discussion 5 min MSTLessonPlan.docx MST Lesson Plan Overview Minimal Spanning Trees Summary Many networks link our society: telephone networks, utility supply networks, computer networks, and road networks. For a particular network there

More information

Week 9 Student Responsibilities. Mat Example: Minimal Spanning Tree. 3.3 Spanning Trees. Prim s Minimal Spanning Tree.

Week 9 Student Responsibilities. Mat Example: Minimal Spanning Tree. 3.3 Spanning Trees. Prim s Minimal Spanning Tree. Week 9 Student Responsibilities Reading: hapter 3.3 3. (Tucker),..5 (Rosen) Mat 3770 Spring 01 Homework Due date Tucker Rosen 3/1 3..3 3/1 DS & S Worksheets 3/6 3.3.,.5 3/8 Heapify worksheet ttendance

More information

Module 5 Graph Algorithms

Module 5 Graph Algorithms Module 5 Graph lgorithms Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 97 E-mail: natarajan.meghanathan@jsums.edu 5. Graph Traversal lgorithms Depth First

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

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Introduction graph theory useful in practice represent many real-life problems can be if not careful with data structures Chapter 9 Graph s 2 Definitions Definitions an undirected graph is a finite set

More information

SAMPLE. Networks. A view of Königsberg as it was in Euler s day.

SAMPLE. Networks. A view of Königsberg as it was in Euler s day. ack to Menu >>> How are graphs used to represent networks? H P T R 10 Networks How do we analyse the information contained in graphs? How do we use graphs to represent everyday situations? 10.1 Graph theory

More information

CISC 320 Introduction to Algorithms Fall Lecture 15 Depth First Search

CISC 320 Introduction to Algorithms Fall Lecture 15 Depth First Search IS 320 Introduction to lgorithms all 2014 Lecture 15 epth irst Search 1 Traversing raphs Systematic search of every edge and vertex of graph (directed or undirected) fficiency: each edge is visited no

More information

CSE 21: Mathematics for Algorithms and Systems Analysis

CSE 21: Mathematics for Algorithms and Systems Analysis CSE 21: Mathematics for Algorithms and Systems Analysis Week 10 Discussion David Lisuk June 4, 2014 David Lisuk CSE 21: Mathematics for Algorithms and Systems Analysis June 4, 2014 1 / 26 Agenda 1 Announcements

More information

Math 222 (A1) Solutions to Assignment 4

Math 222 (A1) Solutions to Assignment 4 Math (1) Solutions to ssignment 1. We have captured several people whom we suspect are part of a spy ring. They are identified as,,,,,, and. fter interrogation, admits to having met the other six. admits

More information

mywbut.com Uninformed Search

mywbut.com Uninformed Search Uninformed Search 1 2.4 Search Searching through a state space involves the following: set of states Operators and their costs Start state test to check for goal state We will now outline the basic search

More information

CSE 101- Winter 18 Discussion Section Week 2

CSE 101- Winter 18 Discussion Section Week 2 S 101- Winter 18 iscussion Section Week 2 Topics Topological ordering Strongly connected components Binary search ntroduction to ivide and onquer algorithms Topological ordering Topological ordering =>

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms S 101, Winter 2018 esign and nalysis of lgorithms Lecture 3: onnected omponents lass URL: http://vlsicad.ucsd.edu/courses/cse101-w18/ nd of Lecture 2: s, Topological Order irected cyclic raph.g., Vertices

More information

Foundations of Discrete Mathematics

Foundations of Discrete Mathematics Foundations of Discrete Mathematics Chapter 12 By Dr. Dalia M. Gil, Ph.D. Trees Tree are useful in computer science, where they are employed in a wide range of algorithms. They are used to construct efficient

More information

Campus Tour. 1/18/2005 4:08 AM Campus Tour 1

Campus Tour. 1/18/2005 4:08 AM Campus Tour 1 ampus Tour //00 :0 M ampus Tour Outline and Reading Overview of the assignment Review djacency matrix structure (..) Kruskal s MST algorithm (..) Partition T and implementation (..) The decorator pattern

More information

Note. Out of town Thursday afternoon. Willing to meet before 1pm, me if you want to meet then so I know to be in my office

Note. Out of town Thursday afternoon. Willing to meet before 1pm,  me if you want to meet then so I know to be in my office raphs and Trees Note Out of town Thursday afternoon Willing to meet before pm, email me if you want to meet then so I know to be in my office few extra remarks about recursion If you can write it recursively

More information

Optimization II: Dynamic programming

Optimization II: Dynamic programming Optimization II: Dynamic programming Ricardo Fukasawa rfukasawa@uwaterloo.ca Department of Combinatorics and Optimization Faculty of Mathematics University of Waterloo Nov 2, 2016 R. Fukasawa (C&O) Optimization

More information

L10 Graphs. Alice E. Fischer. April Alice E. Fischer L10 Graphs... 1/37 April / 37

L10 Graphs. Alice E. Fischer. April Alice E. Fischer L10 Graphs... 1/37 April / 37 L10 Graphs lice. Fischer pril 2016 lice. Fischer L10 Graphs... 1/37 pril 2016 1 / 37 Outline 1 Graphs efinition Graph pplications Graph Representations 2 Graph Implementation 3 Graph lgorithms Sorting

More information

Shortest Paths and Minimum Spanning Trees

Shortest Paths and Minimum Spanning Trees /9/ hortest Paths and Minimum panning Trees dmin avid Kauchak cs0 pring 0 ijkstra s algorithm What about ijkstra s on? 0-0 /9/ What about ijkstra s on? ijkstra s algorithm only works for positive edge

More information

Campus Tour Goodrich, Tamassia. Campus Tour 1

Campus Tour Goodrich, Tamassia. Campus Tour 1 ampus Tour 00 oodrich, Tamassia ampus Tour raph ssignment oals Learn and implement the adjacency matrix structure an Kruskal s minimum spanning tree algorithm Understand and use the decorator pattern and

More information

Topic 10 Part 2 [474 marks]

Topic 10 Part 2 [474 marks] Topic Part 2 [474 marks] The complete graph H has the following cost adjacency matrix Consider the travelling salesman problem for H a By first finding a minimum spanning tree on the subgraph of H formed

More information

Simple Graph. General Graph

Simple Graph. General Graph Graph Theory A graph is a collection of points (also called vertices) and lines (also called edges), with each edge ending at a vertex In general, it is allowed for more than one edge to have the same

More information

To recognize congruent figures and their corresponding parts

To recognize congruent figures and their corresponding parts 4-1 ongruent igures ontent Standard Prepares for G.SR.5 Use congruence... criteria for triangles to solve problems and prove relationships in geometric figures. Objective o recognize congruent figures

More information

Math for Liberal Arts MAT 110: Chapter 13 Notes

Math for Liberal Arts MAT 110: Chapter 13 Notes Math for Liberal Arts MAT 110: Chapter 13 Notes Graph Theory David J. Gisch Networks and Euler Circuits Network Representation Network: A collection of points or objects that are interconnected in some

More information

1 Shortest Paths. 1.1 Breadth First Search (BFS) CS 124 Section #3 Shortest Paths and MSTs 2/13/2018

1 Shortest Paths. 1.1 Breadth First Search (BFS) CS 124 Section #3 Shortest Paths and MSTs 2/13/2018 CS Section # Shortest Paths and MSTs //08 Shortest Paths There are types of shortest paths problems: Single source single destination Single source to all destinations All pairs shortest path In today

More information

Topics. Trees Vojislav Kecman. Which graphs are trees? Terminology. Terminology Trees as Models Some Tree Theorems Applications of Trees CMSC 302

Topics. Trees Vojislav Kecman. Which graphs are trees? Terminology. Terminology Trees as Models Some Tree Theorems Applications of Trees CMSC 302 Topics VCU, Department of Computer Science CMSC 302 Trees Vojislav Kecman Terminology Trees as Models Some Tree Theorems Applications of Trees Binary Search Tree Decision Tree Tree Traversal Spanning Trees

More information

Chapter 14 Section 3 - Slide 1

Chapter 14 Section 3 - Slide 1 AND Chapter 14 Section 3 - Slide 1 Chapter 14 Graph Theory Chapter 14 Section 3 - Slide WHAT YOU WILL LEARN Graphs, paths and circuits The Königsberg bridge problem Euler paths and Euler circuits Hamilton

More information

Shortest Paths and Minimum Spanning Trees

Shortest Paths and Minimum Spanning Trees // hortest Paths and Minimum panning Trees avid Kauchak cs pring dmin an resubmit homeworks - for up to half credit back l ue by the end of the week Read book // // // // // Is ijkstra s algorithm correct?

More information

Grade 7/8 Math Circles Graph Theory - Solutions October 13/14, 2015

Grade 7/8 Math Circles Graph Theory - Solutions October 13/14, 2015 Faculty of Mathematics Waterloo, Ontario N2L 3G1 Centre for Education in Mathematics and Computing Grade 7/8 Math Circles Graph Theory - Solutions October 13/14, 2015 The Seven Bridges of Königsberg In

More information

Supplement to. Logic and Computer Design Fundamentals 4th Edition 1

Supplement to. Logic and Computer Design Fundamentals 4th Edition 1 Supplement to Logic and Computer esign Fundamentals 4th Edition MORE OPTIMIZTION Selected topics not covered in the fourth edition of Logic and Computer esign Fundamentals are provided here for optional

More information

Problem: Large Graphs

Problem: Large Graphs S : ata Structures raph lgorithms raph Search Lecture Problem: Large raphs It is expensive to find optimal paths in large graphs, using S or ijkstra s algorithm (for weighted graphs) How can we search

More information

MAS 341: GRAPH THEORY 2016 EXAM SOLUTIONS

MAS 341: GRAPH THEORY 2016 EXAM SOLUTIONS MS 41: PH THEOY 2016 EXM SOLUTIONS 1. Question 1 1.1. Explain why any alkane C n H 2n+2 is a tree. How many isomers does C 6 H 14 have? Draw the structure of the carbon atoms in each isomer. marks; marks

More information

The Travelling Salesman Problem

The Travelling Salesman Problem The Travelling Salesman Problem The travelling salesman problem cannot be solved directly without vast amounts of processing power, since every possible Hamiltonian cycle would need to be measured. For

More information

CS 5114: Theory of Algorithms. Graph Algorithms. A Tree Proof. Graph Traversals. Clifford A. Shaffer. Spring 2014

CS 5114: Theory of Algorithms. Graph Algorithms. A Tree Proof. Graph Traversals. Clifford A. Shaffer. Spring 2014 epartment of omputer Science Virginia Tech lacksburg, Virginia opyright c 04 by lifford. Shaffer : Theory of lgorithms Title page : Theory of lgorithms lifford. Shaffer Spring 04 lifford. Shaffer epartment

More information

DEPTH-FIRST SEARCH A B C D E F G H I J K L M N O P. Graph Traversals. Depth-First Search

DEPTH-FIRST SEARCH A B C D E F G H I J K L M N O P. Graph Traversals. Depth-First Search PTH-IRST SRH raph Traversals epth-irst Search H I J K L M N O P epth-irst Search 1 xploring a Labyrinth Without etting Lost depth-first search (S) in an undirected graph is like wandering in a labyrinth

More information

The Traveling Salesman Problem (TSP) is where a least cost Hamiltonian circuit is found. CHAPTER 1 URBAN SERVICES

The Traveling Salesman Problem (TSP) is where a least cost Hamiltonian circuit is found. CHAPTER 1 URBAN SERVICES Math 167 eview 1 (c) Janice Epstein HPE 1 UN SEVIES path that visits every vertex exactly once is a Hamiltonian path. circuit that visits every vertex exactly once is a Hamiltonian circuit. Math 167 eview

More information

SUMMARY SHEET DECISION MATHS. Algorithms. Input A and B (positive integers) Let Q = int(b/a) Let R1 = B A Q

SUMMARY SHEET DECISION MATHS. Algorithms. Input A and B (positive integers) Let Q = int(b/a) Let R1 = B A Q the urther Mathematics network www.fmnetwork.org.uk V 07 SUMMRY SHT ISION MTHS lgorithms The main ideas are covered in Q dexcel MI OR The main ideas in this topic are Understanding and implementing a variety

More information

Lecture 25 Spanning Trees

Lecture 25 Spanning Trees Lecture 25 Spanning Trees 15-122: Principles of Imperative Computation (Fall 2018) Frank Pfenning, Iliano Cervesato The following is a simple example of a connected, undirected graph with 5 vertices (A,

More information

Undirected graph is a special case of a directed graph, with symmetric edges

Undirected graph is a special case of a directed graph, with symmetric edges S-6S- ijkstra s lgorithm -: omputing iven a directed weighted graph (all weights non-negative) and two vertices x and y, find the least-cost path from x to y in. Undirected graph is a special case of a

More information

Name Date P R U. In Exercises 4 7, find the indicated measure. Explain your reasoning. D 4x + 5 C I

Name Date P R U. In Exercises 4 7, find the indicated measure. Explain your reasoning. D 4x + 5 C I ame ate 6.1 ractice In xercises 1 3, tell whether the information in the diagram allows you to conclude that point lies on the perpendicular bisector of, or on the angle bisector of. xplain your reasoning.

More information

Altitudes and Perpendicular Bisectors

Altitudes and Perpendicular Bisectors 6 2 hat ou ll Learn ou ll learn to identify and construct s and perpendicular bisectors in triangles. ltitudes and erpendicular isectors In geometry, an of a triangle is a perpendicular segment with one

More information

Module 2: NETWORKS AND DECISION MATHEMATICS

Module 2: NETWORKS AND DECISION MATHEMATICS Further Mathematics 2017 Module 2: NETWORKS AND DECISION MATHEMATICS Chapter 9 Undirected Graphs and Networks Key knowledge the conventions, terminology, properties and types of graphs; edge, face, loop,

More information

Understand graph terminology Implement graphs using

Understand graph terminology Implement graphs using raphs Understand graph terminology Implement graphs using djacency lists and djacency matrices Perform graph searches Depth first search Breadth first search Perform shortest-path algorithms Disjkstra

More information

Lecture 25 Notes Spanning Trees

Lecture 25 Notes Spanning Trees Lecture 25 Notes Spanning Trees 15-122: Principles of Imperative Computation (Spring 2016) Frank Pfenning 1 Introduction The following is a simple example of a connected, undirected graph with 5 vertices

More information

Further Mathematics 2016 Module 2: NETWORKS AND DECISION MATHEMATICS Chapter 9 Undirected Graphs and Networks

Further Mathematics 2016 Module 2: NETWORKS AND DECISION MATHEMATICS Chapter 9 Undirected Graphs and Networks Further Mathematics 2016 Module 2: NETWORKS AND DECISION MATHEMATICS Chapter 9 Undirected Graphs and Networks Key knowledge the conventions, terminology, properties and types of graphs; edge, face, loop,

More information

Identify similar figures. Solve problems involving scale factors. do artists use geometric patterns?

Identify similar figures. Solve problems involving scale factors. do artists use geometric patterns? imilar Polygons Identify similar figures. olve problems involving scale factors. Vocabulary similar polygons scale factor do artists use geometric patterns? M.. scher (19 19) was a utch graphic artist

More information

The Konigsberg Bridge Problem

The Konigsberg Bridge Problem The Konigsberg Bridge Problem This is a classic mathematical problem. There were seven bridges across the river Pregel at Königsberg. Is it possible to take a walk in which each bridge is crossed exactly

More information

Dijkstra s algorithm for shortest paths when no edges have negative weight.

Dijkstra s algorithm for shortest paths when no edges have negative weight. Lecture 14 Graph Algorithms II 14.1 Overview In this lecture we begin with one more algorithm for the shortest path problem, Dijkstra s algorithm. We then will see how the basic approach of this algorithm

More information

1. trees does the network shown in figure (a) have? (b) How many different spanning. trees does the network shown in figure (b) have?

1. trees does the network shown in figure (a) have? (b) How many different spanning. trees does the network shown in figure (b) have? 2/28/18, 8:24 M 1. (a) ow many different spanning trees does the network shown in figure (a) have? (b) ow many different spanning trees does the network shown in figure (b) have? L K M P N O L K M P N

More information

Programming Abstractions

Programming Abstractions Programming bstractions S 1 0 6 X ynthia ee Upcoming Topics raphs! 1. asics What are they? ow do we represent them? 2. Theorems What are some things we can prove about graphs? 3. readth-first search on

More information

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29 Lecture 13 Connectedness in graphs Spanning trees in graphs Finding a minimal spanning tree Time costs of graph problems and NP-completeness Finding a minimal spanning tree: Prim s and Kruskal s algorithms

More information

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE Professor Kindred Math 104, Graph Theory Homework 3 Solutions February 14, 2013 Introduction to Graph Theory, West Section 2.1: 37, 62 Section 2.2: 6, 7, 15 Section 2.3: 7, 10, 14 DO NOT RE-DISTRIBUTE

More information

Essential Question How can you describe angle pair relationships and use these descriptions to find angle measures?

Essential Question How can you describe angle pair relationships and use these descriptions to find angle measures? 1.6 escribing Pairs of ngles OMMON OR Learning Standard HSG-O..1 ssential Question How can you describe angle pair relationships and use these descriptions to find angle measures? Finding ngle Measures

More information

Homework Assignment #3 Graph

Homework Assignment #3 Graph CISC 4080 Computer Algorithms Spring, 2019 Homework Assignment #3 Graph Some of the problems are adapted from problems in the book Introduction to Algorithms by Cormen, Leiserson and Rivest, and some are

More information

Tree. number of vertices. Connected Graph. CSE 680 Prof. Roger Crawfis

Tree. number of vertices. Connected Graph. CSE 680 Prof. Roger Crawfis Tree Introduction to lgorithms Spanning Trees CSE Prof. Roger Crawfis We call an undirected graph a tree if the graph is connected and contains no cycles. Trees: Not Trees: Not connected Has a cycle Number

More information

Topological Sort. CSE 373 Data Structures Lecture 19

Topological Sort. CSE 373 Data Structures Lecture 19 Topological Sort S 373 ata Structures Lecture 19 Readings and References Reading Section 9.2 Some slides based on: S 326 by S. Wolfman, 2000 11/27/02 Topological Sort - Lecture 19 2 Topological Sort 142

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

14 Graph Theory. Exercise Set 14-1

14 Graph Theory. Exercise Set 14-1 14 Graph Theory Exercise Set 14-1 1. A graph in this chapter consists of vertices and edges. In previous chapters the term was used as a visual picture of a set of ordered pairs defined by a relation or

More information

CSE 100: GRAPH ALGORITHMS

CSE 100: GRAPH ALGORITHMS CSE 100: GRAPH ALGORITHMS Dijkstra s Algorithm: Questions Initialize the graph: Give all vertices a dist of INFINITY, set all done flags to false Start at s; give s dist = 0 and set prev field to -1 Enqueue

More information