Скачать презентацию
Идет загрузка презентации. Пожалуйста, подождите
Презентация была опубликована 9 лет назад пользователемАлевтина Айдарова
1 Minimum spanning trees
4 Minimum Connector Algorithms Kruskals algorithm 1.Select the shortest edge in a network 2.Select the next shortest edge which does not create a cycle 3.Repeat step 2 until all vertices have been connected Prims algorithm 1.Select any vertex 2.Select the shortest edge connected to that vertex 3.Select the shortest edge connected to any vertex already connected 4.Repeat step 3 until all vertices have been connected
5 A cable company want to connect five villages to their network which currently extends to the market town of Avonford. What is the minimum length of cable needed? Avonford Fingley Brinleigh Cornwell Donster Edan Example
6 We model the situation as a network, then the problem is to find the minimum connector for the network A F B C D E
7 A F B C D E List the edges in order of size: ED 2 AB 3 AE 4 CD 4 BC 5 EF 5 CF 6 AF 7 BF 8 CF 8 Kruskals Algorithm
8 Select the shortest edge in the network ED 2 Kruskals Algorithm A F B C D E
9 Select the next shortest edge which does not create a cycle ED 2 AB 3 Kruskals Algorithm A F B C D E
10 Select the next shortest edge which does not create a cycle ED 2 AB 3 CD 4 (or AE 4) Kruskals Algorithm A F B C D E
11 Select the next shortest edge which does not create a cycle ED 2 AB 3 CD 4 AE 4 Kruskals Algorithm A F B C D E
12 Select the next shortest edge which does not create a cycle ED 2 AB 3 CD 4 AE 4 BC 5 – forms a cycle EF 5 Kruskals Algorithm A F B C D E
13 All vertices have been connected. The solution is ED 2 AB 3 CD 4 AE 4 EF 5 Total weight of tree: 18 Kruskals Algorithm A F B C D E
14 A F B C D E Select any vertex A Select the shortest edge connected to that vertex AB 3 Prims Algorithm
15 A F B C D E Select the shortest edge connected to any vertex already connected. AE 4 Prims Algorithm
16 Select the shortest edge connected to any vertex already connected. ED 2 Prims Algorithm A F B C D E
17 Select the shortest edge connected to any vertex already connected. DC 4 Prims Algorithm A F B C D E
18 Select the shortest edge connected to any vertex already connected. EF 5 Prims Algorithm A F B C D E
19 A F B C D E All vertices have been connected. The solution is AB 3 AE 4 ED 2 DC 4 EF 5 Total weight of tree: 18
20 Both algorithms will always give solutions with the same length. They will usually select edges in a different order – you must show this in your workings. Occasionally they will use different edges – this may happen when you have to choose between edges with the same length. In this case there is more than one minimum connector for the network. Some points to note
21 Construction of Prism Algorithm Method II
30 Construction of Kruskal Algorithm Method II
32 Mind Map
Еще похожие презентации в нашем архиве:
© 2024 MyShared Inc.
All rights reserved.