Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a directed graph G=(V,E) using Adjacency List Method. here V is a set of vertices and E is a set of ordered pairs of
Create a directed graph G=(V,E) using Adjacency List Method. here V is a set of vertices and E is a set of ordered pairs of vertices called edges. An edge(i,j) is directed from i to j.
Task 1: Create a directed graph G (VE) using Adjacency List method. Here V is a set of vertices and E is a set of ordered pairs of vertices called edges. An edge(i) is directed from 1 to Design and implement a graph class using the adjacency list method as explained in the class lecture. The nodes should store strings The class should have the following methods fully implemented. i. ii. 111. iv. v. vi, vii. Constructor - This should have an overload indicating the number of vertices in the graph. addNode(i) - adds a node to the graph. i is the value stored in the node addEdge(LJ)-Add the edge (ij) to E. removeEdge(LJ)-Remove the edge (ij) from E removeNode(i) - Removes the node from the graph. hasEdge(LJ)-Check if the edge (LJ) E E. outEdges(i) - Return a list of all integers j such that edge (ij)E E. viii. inEdges(i) - Return a list of all integers j such that edge (j.i) E E ix. Destructor Task 1: Create a directed graph G (VE) using Adjacency List method. Here V is a set of vertices and E is a set of ordered pairs of vertices called edges. An edge(i) is directed from 1 to Design and implement a graph class using the adjacency list method as explained in the class lecture. The nodes should store strings The class should have the following methods fully implemented. i. ii. 111. iv. v. vi, vii. Constructor - This should have an overload indicating the number of vertices in the graph. addNode(i) - adds a node to the graph. i is the value stored in the node addEdge(LJ)-Add the edge (ij) to E. removeEdge(LJ)-Remove the edge (ij) from E removeNode(i) - Removes the node from the graph. hasEdge(LJ)-Check if the edge (LJ) E E. outEdges(i) - Return a list of all integers j such that edge (ij)E E. viii. inEdges(i) - Return a list of all integers j such that edge (j.i) E E ix. DestructorStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started