1 / 13

Section 14.4

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.

deidra
Télécharger la présentation

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Section 14.4 Trees

  2. 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

  3. 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.

  4. 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.

  5. 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.

  6. 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.

  7. 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.

  8. 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)

  9. 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.

  10. 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.

  11. 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

  12. 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

  13. 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 .

More Related