Question: 1. Write a C++ class derived from Graphic Interface, as given in Listing 20-1. Use an adjacency matrix to represent the graph. 2. Repeat the

1. Write a C++ class derived from Graphic Interface, as given in Listing 20-1. Use an adjacency matrix to represent the graph.
2. Repeat the previous programming problem, but represent the graph using an adjacency list instead of an adjacency matrix.
3. Repeat Programming problems 1 and 2, but allow the graph to be either weighted or unweighted and either directed or undirected.
4. Extend Programming Problem 3 by adding ADT operations such as is Connected and has Cycle. Also, include operations that perform a topological sort for a directed graph without cycles, find the Depth First Search and Breadth First Search spanning trees for a connected graph, and find a minimum spanning tree for a connected undirected graph.

Step by Step Solution

3.35 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

class Graph private bool adjacencyMatrix int vertexCount public Graphint vertexCount this vertexCount vertexCount adjacencyMatrix new boolvertexCount for int i 0 i vertexCount i adjacencyMatrixi new b... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

1019-B-C-A-C-P-A(4679).docx

120 KBs Word File

Students Have Also Explored These Related Cost Accounting Questions!