Complete this assignment by writing the code using language C

ghatpbzcn
timer Asked: Sep 10th, 2017

Question Description

using C language program for writing code on word document

Unformatted Attachment Preview

A minimum spanning tree of an undirected graph G is a tree formed from graph edges that connect all the vertices of G at the lowest total weight. Kruskal’s algorithm builds the minimum spanning tree by repeatedly selecting from G the edge not yet added to the minimum spanning tree that has the least possible weight, and then uses that edge to connect the two closest trees in a forest of minimum spanning trees. The pseudocode for Kruskal’s algorithm requires the following data structures (C definitions are provided for your convenience): (a) A priority queue to store the edges of the graph G in order by weight. struct Edge { Object vertex1; Object vertex2; int distance; }; Edge q [MAX_EDGES]; (b) An unsorted list to store the edges in the minimum spanning tree. Edge t [MAX_EDGES]; (c) An AVL tree to store the forest of minimum spanning trees. struct VertexNode; struct VertexNode { Object vertex; VertexNode *next; }; struct SubsetNode { int size; VertexNode *firstVertex; }; struct SetNode { Object vertex; SetNode *left; SubsetNode *subset; SetNode *right; }; SetNode *s; (d) Various local variables. int edgeCount, vertexCount, z, i; Object x, y, w; SetNode *v, *v1, *v2; Edge e, temp; In order to receive a passing grade on this assignment, you need to: (a) Use separate .c and .h files for main and the code associated with the various data structures. (b) Use functions and procedures extensively. (c) Use a Makefile to guide compilation. (d) Use a program style and format that is “easy” to read. In order to receive a passing grade on this assignment, you need to show: (a) Evidence that the program is working correctly. Using the input data for the seven vertex graph discussed in class, build the data structures according to the Initialization phase. After the data structures have been built, print them out (you will have to develop your own print algorithms). Finally, print the edges in the minimum spanning tree generated from the seven vertex graph. (b) A minimum spanning tree that connects all the vertices in a “large” graph. Using the graph described in the graph.txt file in the /home/venus/hilder/cs340/assignment3/datafiles directory as input to your program, print the edges in the minimum spanning tree. Submit to UR Courses: (1) any .c and .h files you created (and only the .c and .h files), where the files are zipped into a separate, single file with a name that clearly describes the contents, and (2) separate script files showing the output generated by your program as described directly above in parts (a) and (b).
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

This question has not been answered.

Create a free account to get help with this and any other question!

Related Tags

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors