Section 14 4
This presentation is the property of its rightful owner.
Sponsored Links
1 / 13

Section 14.4 PowerPoint PPT Presentation


  • 54 Views
  • Uploaded on
  • Presentation posted in: General

Section 14.4 . Trees. Remember. A graph is connected if there is a path between any two vertices. Otherwise we say that the graph is disconnected . Connected Graph Disconnected Graph. A. A. B. C. B. C. D. D. F. F. E. E. Remember. AB is the only bridge in this graph.

Download Presentation

Section 14.4

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Section 14 4

Section 14.4

Trees


Remember

Remember

A graph is connected if there is a path between any two vertices.

Otherwise we say that the graph is disconnected.

Connected GraphDisconnected Graph

A

A

B

C

B

C

D

D

F

F

E

E


Remember1

Remember

AB is the only bridge in this graph

Every edge is a bridge in this graph

A

A

B

B

C

D

C

D

F

E

A Bridge is an edge that when removed, it disconnects the graph.


Terminology

Terminology

This graph is not a tree because BC, CD, and DB are not bridges.

This graph is not a tree because it is not connected.

A

A

C

B

B

E

F

C

D

D

A TREE is a connected graph in which every edge is a bridge.


Terminology1

Terminology

These are the tree possible spanning trees.

There are 3 possible spanning trees for this graph

A

A

A

A

B

B

B

B

C

C

D

C

D

D

C

D

A SPANNING TREE is a tree created from another graph by removing edges while still maintaining a path to each vertex.


Terminology2

Terminology

A

A

A

A

8

8

8

8

B

B

B

B

13

5

13

5

5

13

1

1

1

C

D

C

D

D

C

C

D

Cost = 14

Weighted Graph

Cost = 26

Cost = 22

Minimum – cost spanning tree

A MINIMUM – COST SPANNING TREE is the least expensive spanning tree of a graph.


Kruskal s algorithm

Kruskal’s Algorithm

A

7

B

13

C

1

10

97

66

21

D

12

5

F

E

Select the lowers edge on the graph.


Kruskal s algorithm1

Kruskal’s Algorithm

A

7

B

13

C

1

10

97

66

21

D

12

5

F

E

Select the lowers edge on the graph.

Select the second lowest edge (not necessarily adjacent to the one already chosen)


Kruskal s algorithm2

Kruskal’s Algorithm

A

7

B

13

C

1

10

97

66

21

D

12

5

F

E

Select the lowers edge on the graph

Select the second lowest edge (not necessarily adjacent to the one already chosen)

Continue selecting the next lowest edge taking care not to create any circuits.


Kruskal s algorithm3

Kruskal’s Algorithm

A

7

B

13

C

1

10

97

66

21

D

12

5

F

E

Select the lowers edge on the graph

Select the second lowest edge (not necessarily adjacent to the one already chosen)

Continue selecting the next lowest edge taking care not to create any circuits.

Stop when there is a path to every vertex.


Kruskal s algorithm4

Kruskal’s Algorithm

A

7

B

13

C

1

10

97

66

21

D

12

5

F

E

A

7

B

13

1

C

Cost =38

D

12

Select the lowers edge on the graph

Select the second lowest edge (not necessarily adjacent to the one already chosen)

Continue selecting the next lowest edge taking care not to create any circuits.

Stop when there is a path to every vertex.

Copy the min – cost spanning tree below the graph.

5

F

E


Irrigation system

Irrigation System

Bougainvillea

Juniper

75

  • Try to find the minimum – cost spanning tree yourself, then go to the next slide and check your answer.

37

47

Jasmine

26

42

25

35

11

Orchid

29

24

61

Azalea

(problem 28 p.971) Lucille wants to install an irrigation system to water all six of her flowerbeds. Use Kruskal’s algorithm to find the smallest length of pipes she would need to install.

Passion Flower


Irrigation system1

Irrigation System

Bougainvillea

  • Note that we do not select the edge Jasmine – Azalea (35) since selecting that edge would create a redundancy in the solution (two ways to get water to Azaleas).

Juniper

37

Jasmine

26

11

Orchid

29

24

Azalea

Passion Flower

(problem 28 p.971)

The smallest length of pipes she can use is .


  • Login