spanning trees introduction to spanning trees aqr mrs. banks original source: prof. roger crawfis...

8
Introduction to Spanning Trees AQR MRS. BANKS ginal Source: Prof. Roger Crawfis from Ohio State University

Upload: juliet-palmer

Post on 31-Dec-2015

224 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Spanning Trees Introduction to Spanning Trees AQR MRS. BANKS Original Source: Prof. Roger Crawfis from Ohio State University

Introduction toSpanning Trees

AQR

MRS. BANKS

Original Source: Prof. Roger Crawfis from Ohio State University

Page 2: Spanning Trees Introduction to Spanning Trees AQR MRS. BANKS Original Source: Prof. Roger Crawfis from Ohio State University

A graph in which there is at least one path between each pair of vertices.

Connected Graph

This is a connected graph. This is NOT a connected graph.

Page 3: Spanning Trees Introduction to Spanning Trees AQR MRS. BANKS Original Source: Prof. Roger Crawfis from Ohio State University

A path that starts and ends at the same vertex and does not use any edge more than once. IT DOES NOT HAVE TO USE ALL THE EDGES.

This graph has NO cycles.

This graph has 3 cycles.

Cycle

Page 4: Spanning Trees Introduction to Spanning Trees AQR MRS. BANKS Original Source: Prof. Roger Crawfis from Ohio State University

We call a graph a tree if the graph is connected and contains no cycles.

Trees:

Not Trees:

Not connected

Has a cycle

Tree

Page 5: Spanning Trees Introduction to Spanning Trees AQR MRS. BANKS Original Source: Prof. Roger Crawfis from Ohio State University

A subgraph that includes every vertex of the original, and is a tree.

Graph G

The following are two different spanning trees of Graph G.

Spanning Tree

Page 6: Spanning Trees Introduction to Spanning Trees AQR MRS. BANKS Original Source: Prof. Roger Crawfis from Ohio State University

A spanning tree that has minimum total weight. ◦ Technically it is a minimum-weight spanning tree.

Minimum Spanning Tree

Graph G

The following are two different spanning trees of Graph G, however the first one is the minimum spanning tree.

Page 7: Spanning Trees Introduction to Spanning Trees AQR MRS. BANKS Original Source: Prof. Roger Crawfis from Ohio State University

There are many approaches to computing a minimum spanning tree. We could try to detect cycles and remove edges, but the algorithm we will study build them from the bottom-up in a greedy fashion.

Kruskal’s Algorithm – starts with a graph of only the vertices and then adds the edge with the minimum weight to connect two vertices.

Kruskal’s Algorithm

Step 1: Put all of the weights in a list from smallest to largest.

Step 2: Find the smallest weight in the list and draw the associated edge and two vertices AS LONG AS IT DOES NOT CREATE A CYCLE!!!

Step 3: Remove this weight from the list.

Step 4: Repeat steps 2 and 3 until ALL the vertices are CONNECTED.

Page 8: Spanning Trees Introduction to Spanning Trees AQR MRS. BANKS Original Source: Prof. Roger Crawfis from Ohio State University

Extra Information Minimum-cost spanning trees have many applications.

◦ Building cable networks that join n locations with minimum cost.◦ Building a road network that joins n cities with minimum cost.◦ Obtaining an independent set of circuit equations for an electrical network.◦ In pattern recognition minimal spanning trees can be used to find noisy

pixels.