![]() |
![]() ![]() ![]() ![]() ![]() |
![]() ![]() |
![]() |
![]() |
![]() ![]() |
Author | Message | ||||||||||||||||||||||||||||||||||||||||||||||||
gita
Newbie ![]() Joined: 08Apr2007 Online Status: Offline Posts: 19 |
![]() ![]() ![]() Posted: 08Apr2007 at 11:19pm |
||||||||||||||||||||||||||||||||||||||||||||||||
7.2 Minimum-Cost spanning trees
Let G=(V,E) be an undirected connected graph. A sub-graph t = (V,E1) of G is a spanning tree of G if and only if t is a tree.
![]() ![]()
![]() Start with v1 and pick the smallest entry in row1, which is either (v1,v2) or (v1,v5). Let us pick (v1, v5). The closest neighbor of the subgraph (v1,v5) is v4 as it is the smallest in the rows v1 and v5. The three remaining edges selected following the above procedure turn out to be (v4,v6) (v4,v3) and (v3, v2) in that sequence. The resulting shortest spanning tree is shown in fig 7.4. The weight of this tree is 41.5. 7.2.3 Kruskal’s Algorithm: There is a second possible interpretation of the optimization criteria mentioned earlier in which the edges of the graph are considered in non-decreasing order of cost. This interpretation is that the set t of edges so far selected for the spanning tree be such that it is possible to complete t into a tree. Thus t may not be a tree at all stages in the algorithm. In fact, it will generally only be a forest since the set of edges t can be completed into a tree if and only if there are no cycles in t. this method is due to kruskal. The Kruskal algorithm can be illustrated as folows, list out all edges of graph G in order of non-decreasing weight. Next select a smallest edge that makes no circuit with previously selected edges. Continue this process until (n-1) edges have been selected and these edges will constitute the desired shortest spanning tree. For fig 7.3 kruskal solution is as follows, V1 to v2 =10 V1 to v3 = 16 V1 to v4 = 11 V1 to v5 = 10 V1 to v6 = 17 V2 to v3 = 9.5 V2 to v6 = 19.5 V3 to v4 = 7 V3 to v6 =12 V4 to v5 = 8 V4 to v6 = 7 V5 to v6 = 9 The above path in ascending order is V3 to v4 = 7 V4 to v6 = 7 V4 to v5 = 8 V5 to v6 = 9 V2 to v3 = 9.5 V1 to v5 = 10 V1 to v2 =10 V1 to v4 = 11 V3 to v6 =12 V1 to v3 = 16 V1 to v6 = 17 V2 to v6 = 19.5 Select the minimum, i.e., v3 to v4 connect them, now select v4 to v6 and then v4 to v5, now if we select v5 to v6 then it forms a circuit so drop it and go for the next. Connect v2 and v3 and finally connect v1 and v5. Thus, we have a minimum spanning tree, which is similar to the figure 7.4.click here for more details: http://www.vyomworld.com/gate/cs/ada/7.2.asp Post Resume: Click here to Upload your Resume & Apply for Jobs |
|||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||
![]() ![]() |
||
Forum Jump |
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
|
© Vyom Technosoft Pvt. Ltd. All Rights Reserved.