Starting from:
$30

$24

Homework 6 Solution

Name your implementation file as LastName(3 to 5 letters)_FirstNameInitial_HW6_QX.cpp Note: You can only use iostream, cassert, cctype, cmath, cstdio, and cstdlib.




Create a temple class called graph as an adjacency matrix with the following:



Private member variables for label/name for the vertices, weighted edges, and number of vertices



Constructors (default and copy)
Add a vertex
Add an edge
Remove an edge
Print the edges as a matrix (neatly)
Return the number of vertices
Return the number of edges
Return is there an edge between two vertices
Return a dynamic array of the neighbors of a vertex
Same as question one but implemented as an adjacency list.

Instead of printing the edges as a matrix, print it as a list
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.

More products