Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include using namespace std; #include GRAPH.h void main() { char vertex[] = {'S', 'R', 'G', 'B', 'O', 'T', 'V'}; int numVertices = sizeof(vertex)/sizeof(char); GRAPH g(vertex,

image text in transcribed

#include using namespace std; #include "GRAPH.h"

void main() { char vertex[] = {'S', 'R', 'G', 'B', 'O', 'T', 'V'}; int numVertices = sizeof(vertex)/sizeof(char); GRAPH g(vertex, numVertices);

g.setEdge('S', 'R', 10); g.setEdge('S', 'T', 120); g.setEdge('R', 'O', 60); g.setEdge('R', 'T', 90); g.setEdge('R', 'V', 120); g.setEdge('G', 'B', 30); g.setEdge('O', 'T', 20); g.setEdge('T', 'V', 30);

cout

Please, it's urgent

The file UndirectedGraph.cpp contains the code for defining the vertices of an undirected graph. Use this file to write a program that will put the weights of the edges to be the absolute values of the differences between the values of the vertices. If a number is repeated, it should not be included in the graph. From the thus obtained undirected graph create a minimum spanning tree according to the Kruscal's algorithm. Print the tree. Then, find the edge that has the lowest value (weight) and print the vertices connected with that edge, as well as the edge weight. The file UndirectedGraph.cpp contains the code for defining the vertices of an undirected graph. Use this file to write a program that will put the weights of the edges to be the absolute values of the differences between the values of the vertices. If a number is repeated, it should not be included in the graph. From the thus obtained undirected graph create a minimum spanning tree according to the Kruscal's algorithm. Print the tree. Then, find the edge that has the lowest value (weight) and print the vertices connected with that edge, as well as the edge weight

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions