In a situation that can be modelled by a graph, Kruskal’s algorithm is a mathematical tool that can be used to reduce costs, materials or time.
Consider the weighted graph G below.
Prim’s algorithm is a second method of finding the minimum spanning tree of a graph.
Consider the weighted graph below.
Information may be given to you either in the form of a graph or as a weighted adjacency table. Prim’s algorithm can be adapted to be used from the adjacency matrix.
Celeste is building a model city incorporating 6 main buildings that need to be connected to an electrical supply.
Each vertex listed in the table below represents a building and the weighting of each edge is the cost in USD of creating a link to the electrical supply between the given vertices.
A | B | C | D | E | F | |
A | - | 4 | 9 | 8 | 11 | 3 |
B | 4 | - | 13 | 2 | 5 | 12 |
C | 9 | 13 | - | 7 | 1 | 4 |
D | 8 | 2 | 7 | - | 10 | 3 |
E | 11 | 5 | 1 | 10 | - | 15 |
F | 3 | 12 | 4 | 3 | 15 | - |
Celeste wants to find the lowest cost solution that links all 6 buildings up to the electrical supply.
转载自savemyexams
© 2024. All Rights Reserved. 沪ICP备2023009024号-1