Question: Write a program to perform the following in C++: 1) Implement Kruskal's Algorithm OR Prim's Algorithm. 2) Read a graph data file. Each line contains

Write a program to perform the following in C++:

1) Implement Kruskal's Algorithm OR Prim's Algorithm.

2) Read a graph data file. Each line contains weighted edge: vertex, vertex, weight

3) Using the implemented algorithm, find the minimum spanning tree of the graph.

4)Report the minimum spanning tree and the total weight of the minimum spanning tree.

graph.txt:

A,J,91 A,H,86 A,B,38 A,N,37 A,L,100 A,V,64 A,S,84 A,M,9 A,W,54 A,K,46 B,J,27 B,V,93 B,H,40 B,G,49 B,F,94 B,N,95 B,C,45 B,Z,42 B,L,15 C,Q,14 C,W,10 C,L,87 C,R,77 C,N,92 C,S,79 C,T,3 C,D,60 C,J,43 D,P,26 D,W,12 D,K,21 D,Q,5 D,V,75 D,T,59 D,J,2 D,R,11 F,J,63 F,X,72 F,L,88 F,G,51 F,V,61 F,P,39 F,M,69 F,W,65 G,N,76 G,X,13 G,Z,56 G,H,82 G,Q,32 G,W,20 G,V,18 H,Z,74 H,P,85 H,L,62 H,M,44 H,K,25 H,J,98 H,R,19 J,V,31 J,M,50 J,S,57 J,Q,17 J,T,22 J,P,68 K,T,67 K,L,81 K,M,55 K,P,52 K,S,83 K,X,41 L,R,36 L,N,30 L,T,53 L,S,23 L,Q,66 M,S,6 M,Q,29 M,N,71 M,R,8 M,T,96 N,T,16 N,R,78 N,Q,73 N,V,24 P,Z,28 P,W,48 P,Q,7 P,T,47 Q,W,99 Q,S,1 Q,Z,89 R,V,70 R,X,35 R,S,33 S,T,34 S,X,90 T,X,4 T,W,58 V,X,80 W,Z,97

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!