Solved–Homework 6 –Solution

$30.00 $19.00

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…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

5/5 – (2 votes)

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.

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

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

    1. Constructors (default and copy)

    2. Add a vertex

    3. Add an edge

    4. Remove an edge

    5. Print the edges as a matrix (neatly)

    6. Return the number of vertices

    7. Return the number of edges

    8. Return is there an edge between two vertices

    9. Return a dynamic array of the neighbors of a vertex

  1. Same as question one but implemented as an adjacency list.

    1. Instead of printing the edges as a matrix, print it as a list

    2. 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.