CSc 21200 – Homework 6

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment

Description

5/5 - (3 votes)

1. Create a temple class called graph as an adjacency matrix with the following:
a. Private member variables for label/name for the vertices, weighted edges, and number of
vertices
b. Constructors (default and copy)
c. Add a vertex
d. Add an edge
e. Remove an edge
f. Print the edges as a matrix (neatly)
g. Return the number of vertices
h. Return the number of edges
i. Return is there an edge between two vertices
j. Return a dynamic array of the neighbors of a vertex
2. Same as question one but implemented as an adjacency list.
a. Instead of printing the edges as a matrix, print it as a list
b. Instead of returning a dynamic array of the neighbors of a vertex, return a linked list.
Note:
Assume a weight of zero is no edge.
Assume label/name are only one char long for printing.
Assume when the user enters vertices, they are all unique.