Undirected graph has scanning tree

Assignment Help C/C++ Programming
Reference no: EM13168313

undirected graph has scanning trees. The minimal scanning tree is the scanning tree with the minimal sum of weights on edges. The minimal scanning tree can be found by using Prim's algorithm .

Write a program using C++ to find the minimal scanning tree of a graph. The graph is represented by an adjacency matrix. The adjacency matrix of a graph G = <V, E>

For example, the adjacency matrix of the following graph is on its right side:

The following is Prim's algorithm:

The input of your program should be in the following format:

<the number of vertices of the graph> <the index of the starting vertex>

<the adjacency matrix, arranged line by line>

For example, the input corresponding to the above graph is:

5 1

0 1 3 -1 -1

1 0 3 6 -1

3 3 0 4 2

-1 6 4 0 5

-1 -1 2 5 0

Note that infinity is represented by -1.

The output of your program should be the adjacency matrix of the minimal spanning tree.

For example, the output for the above input is:

0 1 3 -1 -1

1 0 -1 -1 -1

3 -1 0 4 2

-1 -1 4 0 -1

-1 -1 2 -1 0

 

 

Reference no: EM13168313

Questions Cloud

Calculate the mass of lead nitrate that had to be added : Sodium nitrate was added to 2.0 L of water at 25 °C to produce a saturated solution. The solution was then heated to 80 °C. Calculate the mass of lead nitrate that had to be added to produce a saturated solution at that higher temperature.
Pragmatically savvy : Below are descriptions of four university professors. Hopefully you will never have an instructor like  any of them because they are not very pragmatically savvy.
Draw the logic diagram for a circuit that resolves priority : Q:  "Draw the Logic diagram for a circuit that resolves priority among eight active-low inputs, 10_L-17_L, where 10_L has the highest priority.
Describe the australian qualifications framework : Describe the Australian Qualifications Framework. Include a table showing the characteristics of AQF levels and explain the process of developing a training package. List key stakeholders and outline their roles in the process
Undirected graph has scanning tree : undirected graph has scanning trees. The minimal scanning tree is the scanning tree with the minimal sum of weights on edges. The minimal scanning tree can be found by using Prim's algorithm
Sexual response cycle : During the excitement Phase of the sexual response cycle:
Give the contents of eax : in each additional instruction in this problem, assume that EAX contains a given contents before the instruction is executed, and give the contents of EAX as well as the values of the CF, OF, SF, and ZF flags after the instruction is executed:
Construct a 3-bit counter using three d flip-flop : Construct a 3-bit counter using three D flip-flops and a selection of logic gates. The inputs should consist of a signal that resets the counter to 0, called reset
Threatened or actively turned towards communism : Why do you think so many nations chose to pick this time end of warld war II as their own "spring" into greater independence? What were the major grievances they held? And, if they did so, why do you think that so many threatened or actively turned t..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd