Question: Please help me implement this in C++ and please show a sample output, thank you. Topics covered: Implementing a digraph, topological sort of directed acyclic

Please help me implement this in C++ and please show a sample output, thank you.

Please help me implement this in C++ and please show a sample

Topics covered: Implementing a digraph, topological sort of directed acyclic graphs or DAGs Purpose: The purpose of this programming project is to gain experience with implementing digraphs and topological sort. This program involves writing a C++ program for implementing an ADT Directed Graph and performing a topological sort of a DAG. You are to implement the directed graph using pointer-based adjacency lists (using an array of header nodes and a linked list for each header node). Your class Digraph should include constructors and a destructor, operations of edge addition, edge deletion, etc., as well as the operation of topological sorting and acyclic check. You are to implement the topological sorting operation using DFT as discussed in class and Chapter 5 of the textbook. Using appropriate, user-friendly prompts have the user input a set of tasks into an array of strings, e.g., 1. Paint walls 2. Install electrical wiring 3. Lay foundation 4. Do roofing 5. Put up drywall 6. Install plumbing 7. Frame house etc After the user has entered the tasks, your program should then have the user specify (using user-friendly prompts) an order relation on pairs of tasks, e.g 3 1 (indicates that Task 3 must precede Task 1) 7 5 (indicates that Task 7 must precede Task 5) 5 1 (indicates that Task 5 must precede Task 1) etc Your program then applies the topological sorting operation to output the tasks in topological order. In the case where the digraph is not acyclic, your program should output the error message that the directed graph is not a DAG Topics covered: Implementing a digraph, topological sort of directed acyclic graphs or DAGs Purpose: The purpose of this programming project is to gain experience with implementing digraphs and topological sort. This program involves writing a C++ program for implementing an ADT Directed Graph and performing a topological sort of a DAG. You are to implement the directed graph using pointer-based adjacency lists (using an array of header nodes and a linked list for each header node). Your class Digraph should include constructors and a destructor, operations of edge addition, edge deletion, etc., as well as the operation of topological sorting and acyclic check. You are to implement the topological sorting operation using DFT as discussed in class and Chapter 5 of the textbook. Using appropriate, user-friendly prompts have the user input a set of tasks into an array of strings, e.g., 1. Paint walls 2. Install electrical wiring 3. Lay foundation 4. Do roofing 5. Put up drywall 6. Install plumbing 7. Frame house etc After the user has entered the tasks, your program should then have the user specify (using user-friendly prompts) an order relation on pairs of tasks, e.g 3 1 (indicates that Task 3 must precede Task 1) 7 5 (indicates that Task 7 must precede Task 5) 5 1 (indicates that Task 5 must precede Task 1) etc Your program then applies the topological sorting operation to output the tasks in topological order. In the case where the digraph is not acyclic, your program should output the error message that the directed graph is not a DAG

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!