a) Let us consider the following Graph

|
Edge(u,v) |
Weight |
|
b-g |
3 |
|
c-f |
3 |
|
a-f |
4 |
|
e-g |
4 |
|
a-c |
5 |
|
b-e |
5 |
|
d-f |
5 |
|
a-d |
6 |
|
b-d |
6 |
|
d-g |
6 |
|
f-g |
6 |
Kruskal’s Algorithm to find the Minimum Cost Spanning Tree (MCST) of a graph G as follows:
Step 1:
|
Edge(u,v |
Weight |
|
a-b |
2(min) |
|
c-f |
3 |
|
b-g |
3 |
|
a-f |
4 |
|
e-g |
4 |
|
a-c |
5 |
|
b-e |
5 |
|
d-f |
5 |
|
a-d |
6 |
|
b-d |
6 |
|
d-g |
6 |
|
f-g |
6 |
Step 2:
|
Edge(u,v |
Weight |
|
b-g |
3(min) |
|
c-f |
3 |
|
a-f |
4 |
|
e-g |
4 |
|
a-c |
5 |
|
b-e |
5 |
|
d-f |
5 |
|
a-d |
6 |
|
b-d |
6 |
|
d-g |
6 |
|
f-g |
6 |
Step 3:
|
Edge(u,v |
Weight |
|
c-f |
3(min) |
|
a-f |
4 |
|
e-g |
4 |
|
a-c |
5 |
|
b-e |
5 |
|
d-f |
5 |
|
a-d |
6 |
|
b-d |
6 |
|
d-g |
6 |
|
f-g |
6 |

Step 4:
|
Edge(u,v |
Weight |
|
a-f |
4(min) |
|
e-g |
4 |
|
a-c |
5 |
|
b-e |
5 |
|
d-f |
5 |
|
a-d |
6 |
|
b-d |
6 |
|
d-g |
6 |
|
f-g |
6 |
Step 5:
|
Edge(u,v |
Weight |
|
e-g |
4(min) |
|
a-c |
5 |
|
b-e |
5 |
|
d-f |
5 |
|
a-d |
6 |
|
b-d |
6 |
|
d-g |
6 |
|
f-g |
6 |
Step 6:
|
Edge(u,v |
Weight |
|
a-c |
5(forms Loop) |
|
b-e |
5(forms Loop) |
|
d-f |
5(min) |
|
a-d |
6 |
|
b-d |
6 |
|
d-g |
6 |
|
f-g |
6 |

For n- Vertices we get (n-1) Edges in MCST. Here in graph having 7 Vertices so we get 6 Edges
Which is Required MCST of a graph
b) The minimum cost spanning tree generated by the algorithm is

Prim’s Algorithm to find the minimum cost spanning tree of a graph starting at vertex (a) as follows
Step 1: All the vertices connected to (a) will be considered
|
Edge |
Cost |
|
|
a-b |
2(min) |
|
|
a-c |
5 |
|
|
a-d |
6 |
|
|
a-f |
4 |
|
Step 2: All the vertices connected to (a) & (b) will be considered
|
Edge |
Cost |
|
|
a-c |
5 |
|
|
a-d |
6 |
|
|
a-f |
4 |
|
|
b-d |
6 |
|
|
b-e |
5 |
|
|
b-g |
3(min) |
|
Step 3: All the vertices connected to (a), (b) & (g) will be considered
|
.Edge |
Cost |
|
|
a-c |
5 |
|
|
a-d |
6 |
|
|
a-f |
4(min) |
|
|
b-d |
6 |
|
|
b-e |
5 |
|
|
g-d |
6 |
|
|
g-e g-f |
4 6 |
Step 4: All the vertices connected to (a), (b), (f) & (g) will be considered
|
Edge |
Cost |
|
|
a-c |
5 |
|
|
a-d |
6 |
|
|
b-d |
6 |
|
|
b-e |
5 |
|
|
g-d |
6 |
|
|
g-e g-f |
4 6 |
|
|
f-c |
3(min) |
|
|
f-d |
5 |
Step 5: All the vertices connected to (a), (b), (c) ,(f) & (g) will be considered
|
Edge |
Cost |
|
|
a-c |
5 |
|
|
a-d |
6 |
|
|
b-d |
6 |
|
|
b-e |
5 |
|
|
g-d |
6 |
|
|
g-e g-f |
4(min) 6 |
|
|
f-d |
5 |
|
Step 6: All the vertices connected to (a), (b), (c), (e), (f) & (g) will be considered
|
Edge |
Cost |
|
|
a-c |
5(loop) |
|
|
a-d |
6 |
|
|
b-d |
6 |
|
|
b-e |
5 |
|
|
g-d |
6 |
|
|
g-f |
6 |
|
|
f-d |
5(min) |
|
From the above weighted undirected graph Prim’s and Kruskal’s algorithim produce the Same minimal spanning tree
(b) Let us conider the
Graph
Kruskal's Algorithm
Edge: Cost:
B-F 4
E-F 6
G-F 10
A-D 11
A-C 15
B-G 19
D-E 20
A-B 23
B-C 25
C-F 32
A-E 34
C-E 41


From above Prim’s and Kruskal’s algorithim weighted undirected graph such that the weights are distinct (no two edges have the same weight), the minimal spanning tree is unique.
Algorithm Question: The following questions are on minimum spanning tree. (a) Suppose we have an undirected...
You are given an undirected graph G with weighted edges and a minimum spanning tree T of G. Design an algorithm to update the minimum spanning tree when the weight of a single edge is increased. The input to your algorithm should be the edge e and its new weight: your algorithm should modify T so that it is still a MST. Analyze the running time of your algorithm and prove its correctness.
You are given an undirected graph G with weighted edges and a minimum spanning tree T of G. Design an algorithm to update the minimum spanning tree when the weight of a single edge is decreased. The input to your algorithm should be the edge e and its new weight; your algorithm should modify T so that it is still a MST. Analyze the running time of your algorithm and prove its correctness.
JAVA: (29.1) The text introduced Prim’s algorithm for finding a minimum spanning tree. Kruskal’s algorithm is another well-known algorithm for finding a minimum spanning tree. The algorithm repeatedly finds a minimum- weight edge and adds it to the tree if it does not cause a cycle. The process ends when all vertices are in the tree. Design and implement an algorithm for finding an MST using Kruskal’s algorithm.
You are given an undirected graph G = (V, E) with positive weights on the edges. If the edge weights are distinct, then there is only one MST, so both Prim’s and Kruskal’s algorithms will find the same MST. If some of the edge weights are the same, then there can be several MSTs and the two algorithms could find different MSTs. Describe a method that forces Prim’s algorithm to find the same MST of G that Kruskal’s algorithm finds.
Suppose we have a graph G = (V, E) with weights on the edges of E, and we are interested in computing a Minimum Spanning Tree (MST) of G. Suppose we modify the DFS algorithm so that when at a vertex v, we next visit the unvisited neighbor u such that the weight of (u, v) is minimized. Does this produce a MST of G? prove that it does or provide a counter example.
Consider the following weighted undirected graph. (a) Explain why edge (B, D) is safe. In other words, give a cut where the edge is the cheapest edge crossing the cut. (b) We would like to run the Kruskal's algorithm on this graph. List the edges appearing in the Minimum Spanning Tree (MST) in the order they are added to the MST. For simplicity, you can refer to each edge as its weight. (c) 1We would like to run the Prim's algorithm on this...
Problem 4 Let G = (V. E) be an undirected, connected graph with weight function w : E → R. Furthermore, suppose that E 2 |V and that all edge weights are distinct. Prove that the MST of G is unique (that is, that there is only one minimum spanning tree of G).
For minimum spanning tree (MST) construction, Kruskal’s algorithm selects an edge. a) with maximum number of vertices connected to it b) with minimum weight so that cost of MST is always minimum c) that does not introduce a cycle d) none of the above
This problem is dealing with Discrete Math. Please answer fully
and clearly, and show/explain all steps or proofs that you state in
the answer.
4. Let (G, w) be a connected graph with weights on edges so that all weights are distinct positive real numbers. Suppose we find a MST (minimum spanning trees ) in G by using Prim's algorithm. Prove that no matter what vertex we begin with in Prim algorithm, the set of all weights on edges in...
Given the graph above, use Kruska’s algorithm and Prim’s
algorithm to find the minimum spanning tree. Break ties using
alphabetical order (e.g., if edges have the same cost, pick (A, D)
over (A, G) and pick (A, H) over (C, F). Show the order of the
edges added by each algorithm.