Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Introduction to the Prim Algorithm for MST (1) The definition of Minimum spanning trees (MST): G = (V, E) is a weighted connected undirected graph;

  1. Introduction to the Prim Algorithm for MST

(1) The definition of Minimum spanning trees (MST):

  • G = (V, E) is a weighted connected undirected graph;
  • Spanning tree is S = (V, T), T E, undirected tree;
  • Minimum spanning tree (MST) is a spanning tree with the smallest total weight.

(2) The Prim Algorithm for finding MST:

Step 1: x V, Let A = {x}, B = V - {x}.

Step 2: Select (u, v) E, u A, v B such that (u, v) has the smallest weight between A and B.

Step 3: Put (u, v) in the tree. A = A {v}, B = B - {v}

Step 4: If B = , stop; otherwise, go to Step 2.

2. Experimental Purpose

(1)Understand what is the Minimum spanning trees (MST);

(2)Learn what kinds of algorithms can be used to find MST, such as: Kruskal and Prim algorithms;

(3)Compare the difference between these two algorithms;

3. Experimental Contents

(1) Given a undirected Graph G=(V, E) like below, to calculate the minimum spanning tree using Kruskals algorithm and Prims algorithm.

image text in transcribed

4. Experimental Requirement

  1. The template should be used for all kinds of data type, such as: integer, real, double, etc. in the program;
  2. Programs should be made by Object-Oriented Programming (OOP) method;
  3. Use using Kruskals algorithm and Prims algorithm to solve this problem.
  4. And compare the results between these two algorithms and the difference of selection processes.
  5. Write down the report in which there should be the execution results of the program.
10 50 45 40 3 30 35 25 4 5 55 15 20

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

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

Recommended Textbook for

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions