Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

solve it with c++ use graph algorithms don't copy paste from other questions use this code to solve it (don't modify anything just write the

solve it with c++

use graph algorithms

don't copy paste from other questions

image text in transcribedimage text in transcribedimage text in transcribed

use this code to solve it (don't modify anything just write the code for checkMST function in Q2.cpp)

****** make sure the code gives the right answers as it is commented in the main.cpp *********

main.cpp:

#include using namespace std; #include "Q2.cpp" #include

int main(){

int V=4, E1=5, E2=4;

int from1[5]={0,0,0,1,2}; int to1[5]= {1,2,3,2,3}; int Weight1[5]= {4,5,2,7,8}; int from2[4]={0,0,0,1}; int to2[4]= {1,2,3,2}; int Weight2[4]= {4,5,2,7};

if (CheckMST (V,E1,E2,from1,to1,Weight1,from2,to2,Weight2)) cout

if (CheckMST (V,E1,E2,from1,to1,Weight1,from3,to3,Weight3)) cout

Q2.cpp

#include #include

bool CheckMST (int V,int E1,int E2,int from1[],int to1 [],int Weight1[],int from2[],int to2[],int Weight2[]){ return false; }

Minimum Spanning Tree Check Given two undirected weighted graphs G1 and G2, write a function named CheckMST which checks if G2 is a valid MST for G1. The function returns true when valid and false otherwise. Input Your function takes as input three integers: V, E1, and E2 where V is the number of Vertices, E1 is the number of edges for the first graph G1, and E2 is the number of edges for the second graph G2 and: - 3 integer arrays for edges information for graph 1: From1[], To1[], Weight1[] - 3 integer arrays for edges information for graph 2: From2[] ,To2[], Weight2[] Example 1: V=4 E1=5 E2 =4 Graph 1 info Graph 2 info Example 2: V=4 E1=5 E2=4 Graph 1 info Graph 2 info

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students explore these related Databases questions