Discrete Maths Chapter 3: Minimum Connector Problems Lesson 1: Prim’s and Kruskal.

Slides:



Advertisements
Similar presentations
Decision Maths Networks Kruskals Algorithm Wiltshire Networks A Network is a weighted graph, which just means there is a number associated with each.
Advertisements

Lecture 15. Graph Algorithms
Networks Prim’s Algorithm
10.4 Spanning Trees. Def Def: Let G be a simple graph. A spanning tree of G is a subgraph of G that is a tree containing every vertex of G See handout.
Greedy Algorithms Pasi Fränti Greedy algorithm 1.Coin problem 2.Minimum spanning tree 3.Generalized knapsack problem 4.Traveling salesman problem.
MINIMAL CONNECTOR PROBLEMS Problem: A cable TV company is installing a system of cables to connect all the towns in a region. The numbers in the network.
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
Spanning Trees.
Spanning Trees. 2 Spanning trees Suppose you have a connected undirected graph Connected: every node is reachable from every other node Undirected: edges.
Minimum-Cost Spanning Tree weighted connected undirected graph spanning tree cost of spanning tree is sum of edge costs find spanning tree that has minimum.
Design and Analysis of Algorithms Minimum Spanning trees
Spanning Trees. Spanning trees Suppose you have a connected undirected graph –Connected: every node is reachable from every other node –Undirected: edges.
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
Minimum Spanning Tree in Graph - Week Problem: Laying Telephone Wire Central office.
Minimum Spanning Tree Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
1.1 Data Structure and Algorithm Lecture 13 Minimum Spanning Trees Topics Reference: Introduction to Algorithm by Cormen Chapter 13: Minimum Spanning Trees.
Chapter 4: Finding the Shortest Path Lesson 1: Dijkstra’s Algorithm
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
Minimum spanning trees Aims: To know the terms: tree, spanning tree, minimum spanning tree. To understand that a minimum spanning tree connects a network.
Minimum Spanning Trees
Spanning Trees Introduction to Spanning Trees AQR MRS. BANKS Original Source: Prof. Roger Crawfis from Ohio State University.
Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs.
Aim: Graph Theory - Trees Course: Math Literacy Do Now: Aim: What’s a tree?
Minimum spanning trees Aims: To know the terms: tree, spanning tree, minimum spanning tree. To understand that a minimum spanning tree connects a network.
Minimum Spanning Trees Easy. Terms Node Node Edge Edge Cut Cut Cut respects a set of edges Cut respects a set of edges Light Edge Light Edge Minimum Spanning.
Prim's Algorithm This algorithm starts with one node. It then, one by one, adds a node that is unconnected to the new graph to the new graph, each time.
Lecture 19 Greedy Algorithms Minimum Spanning Tree Problem.
Minimal Spanning Tree Problems in What is a minimal spanning tree An MST is a tree (set of edges) that connects all nodes in a graph, using.
TSP – Upper Bounds and Lower Bounds Initial problem : Upper Bound A salesman based in Stockton needs to visit shops based in Darlington, Billingham, Middlesbrough,
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.
The Travelling Salesperson Problem A salesperson needs to visit London, Nottingham, Manchester and Leeds, he lives in Birmingham. Find the shortest route.
Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009.
Minimum- Spanning Trees
Graphs Upon completion you will be able to:
1 22c:31 Algorithms Minimum-cost Spanning Tree (MST)
Prims Algorithm for finding a minimum spanning tree
Graphs Definition: a graph is an abstract representation of a set of objects where some pairs of the objects are connected by links. The interconnected.
D1 Discrete Mathematics
Minimum Spanning Trees
Chapter 5. Greedy Algorithms
Minimum Spanning Tree Chapter 13.6.
Spanning Trees.
Data Structures & Algorithms Graphs
Minimum-Cost Spanning Tree
Spanning Trees.
Minimum Spanning Tree.
Minimum Spanning Trees
Minimum Spanning Tree.
Minimum Spanning Tree.
The Travelling Salesperson problem
D1 Discrete Mathematics
Spanning Trees.
Minimum-Cost Spanning Tree
Kruskal’s Algorithm for finding a minimum spanning tree
Minimum-Cost Spanning Tree
Minimum spanning trees
Chapter 4: Finding the Shortest Path Lesson 1: Dijkstra’s Algorithm
Minimum spanning trees
Minimum spanning trees
Networks Kruskal’s Algorithm
Minimum Spanning Tree.
CSC 380: Design and Analysis of Algorithms
Networks Prim’s Algorithm
Minimum spanning trees
Minimum Spanning Trees (MSTs)
The travelling salesman problem
Prim’s algorithm for minimum spanning trees
CSE 373: Data Structures and Algorithms
Spanning Tree.
Minimum-Cost Spanning Tree
Presentation transcript:

Discrete Maths Chapter 3: Minimum Connector Problems Lesson 1: Prim’s and Kruskal

Can we remember those trees…

A tree is a connected graph of some vertices which contains no cycles

A spanning tree is a connected graph of all vertices which contains no cycles

The minimum spanning tree is the spanning tree with the least weight Length of this tree is 19

The minimum spanning tree is the spanning tree with the least weight Can you find the least weight?

The minimum spanning tree is the spanning tree with the least weight The least weight is 15

The minimum spanning tree is the spanning tree with the least weight The least weight is 15

Notes A tree (a connected graph with no cycles) which connects all the nodes together is called a Spanning Tree For any connected graph with n nodes, each spanning tree will have n - 1 arcs The Minimum Spanning Tree is the one with the Minimum weight

More Notes Prim’s Algorithm is a quick way of finding the Minimum Spanning Tree (or minimum connector) This algorithm is said to be “greedy” since it picks the immediate best option available without taking into account the long-term consequences of the choices made. Kruskal’s Algorithm may also be used to find a minimum spanning tree, but this considers the weights themselves rather than the connecting points

Prim’s Algorithm Step 1: Select any node to be the first node of T. Step 2: Consider the arcs which connect nodes in T to nodes outside T. Pick the one with minimum weight. Add this arc and the extra node to T. (If there are two or more arcs of minimum weight, choose any one of them.) Step 3: Repeat Step 2 until T contains every node of the graph. Aim: To find a minimum spanning tree T

Kruskal’s Algorithm Step 1: Choose the arc of least weight. Step 2: Choose from those arcs remaining the arc of least weight which does not form a cycle with already chosen arcs. (If there are several such arcs, choose one arbitrarily.) Step 3: Repeat Step 2 until n – 1 arcs have been chosen. Aim: To find a minimum spanning tree for a connected graph with n nodes:

Cardiff Sheffield Nottingham Oxford Southampton Bristol Shrewsbury Liverpool Aberystwyth B/ham Manchester

Cardiff Sheffield Nottingham Oxford Southampton Bristol Shrewsbury Liverpool Aberystwyth B/ham Manchester

Cardiff Sheffield Nottingham Oxford Southampton Bristol Shrewsbury Liverpool Aberystwyth B/ham Manchester

Cardiff Sheffield Nottingham Oxford Southampton Bristol Shrewsbury Liverpool Aberystwyth B/ham Manchester

Cardiff Sheffield Nottingham Oxford Southampton Bristol Shrewsbury Liverpool Aberystwyth B/ham Manchester

Cardiff Sheffield Nottingham Oxford Southampton Bristol Shrewsbury Liverpool Aberystwyth B/ham Manchester

Cardiff Sheffield Nottingham Oxford Southampton Bristol Shrewsbury Liverpool Aberystwyth B/ham Manchester

Cardiff Sheffield Nottingham Oxford Southampton Bristol Shrewsbury Liverpool Aberystwyth B/ham Manchester

Cardiff Sheffield Nottingham Oxford Southampton Bristol Shrewsbury Liverpool Aberystwyth B/ham Manchester

Cardiff Sheffield Nottingham Oxford Southampton Bristol Shrewsbury Liverpool Aberystwyth B/ham Manchester

Cardiff Sheffield Nottingham Oxford Southampton Bristol Shrewsbury Liverpool Aberystwyth B/ham Manchester

Cardiff Sheffield Nottingham Oxford Southampton Bristol Shrewsbury Liverpool Aberystwyth B/ham Manchester