(e) (22 points) Consider the following implementation of a weighted
directed graph using the adjacency matrix representation. Write a
non-recursive function named shortestPathN that takes two vertices,
source (src) and destination (dest), and a parameter named N, and
finds the shortest path from the source to the destination with exactly N
edges. There may be more than one path from the source to the
destination with a length of N but you should return the smallest total edge
weight. You should return only the total weight (not the whole path) as the
solution. Return -1 if no such path is found.
class Graph {
public:
};
int shortestPathN ( int src, int dest, int N);
private:
int** adjMat; //weights are positive (0 means no edge)
int numVertices; //number of vertices in the graph
You can assume that a stack implementation with push, pop, getTop,
and isEmpty functions, and a queue implementation with enqueue,
dequeue, getFront, and isEmpty functions are available. You still
need to specify the item structure as a struct if you decide to use a
stack or a queue.