Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please make sure to follow all instructions Goal and Data Structures The goal of this program is to create a SIMPLE, directed graph abstraction using
please make sure to follow all instructions Goal and Data Structures
The goal of this program is to create a SIMPLE, directed graph abstraction using an adjacency list an array of vertices where each element has a vertex and a head pointer to a LLL of edges for adjacent vertices
TRY TO KEEP THIS SIMPLE the goal is to get a feel for how graphs can be created and traversed, but we have limited time
You have decided to create software for event planning. It could be to plan the Thanksgiving feast or a party. It could be to plan a wedding or celebration of some sort.
For a celebration with guests you would need to
Figure our how many guests there will be approximately
Find and reserve a venue, and
Decide upon a date
Once this is done, you can start the design, printing, and mailing of the invitations. In parallel with this, you can start the design and printing of the program. Of course, before you can print a program, you have to decide what bandorchestra you will hire so that information can properly be printed in the program. Before the event takes place, there are tables and chairs to set up and food to prepare and present. This is just an example.
Your assignment will be to take as input tasks that are part of an event planning activity and then build relationships between these tasks. What makes a graph necessary in this case is that there are more complex relationships than just something that is sorted or hierarchical. We need to make sure all of the necessary tasks get done before moving on to the next activity that is dependent.
Part I: the Graph ADT
Your program needs to build an adjacency list. The adjacency list will be an array of vertex objects, and head pointers for each linear linked list representing the edge list. Create the code to allocate an adjacency list for a graph. Load the vertices and edge information into the adjacency list. This information comes from an external file.
The adjacency list should contain:
Vertex Information the task such as printing invitations
Head pointer to an Edge List; the edge list just indicates all of the tasks that can take place after this current task is complete eg after the invitations are printed
Part II: The TestDriver Program
After building the adjacency list from the data set in the external file, allow the client program to perform the following actions:
Display all the tasks
Display all other tasks that need to get done once this task has been complete. Show the vertices that directly connect to this specific vertex.
Depth First Traversal. Show all the vertices that can be reached from this specific vertex.
Also, implement the destructor to deallocate all dynamic memory. There is NO requirement for an INDIVIDUAL DELETE function!
Things you should know...as part of your program
Do not use statically allocated arrays in your classes or structures. All memory must be dynamically allocated and kept to a minimum!
All data members in a class must be private
None of your public member functions should have node data types as arguments. However, you SHOULD have private RECURSIVE member functions that do take node pointers as arguments
Global variables are not allowed in CS not even in your main
Do not use the String class not even in your test suite! use arrays of characters instead!
Use modular design, separating the h files from the cpp files.
Use the iostream library for all IO; do not use stdio.h
Make sure to define a constructor and destructor for your class. Your destructor must deallocate all dynamically allocated memory. NEVER use global variables in these programs!
Avoid the use of exit, continue, or break to alter the flow of control of loops
Avoid using while type of loop control
NEVER use the string class in CS instead use arrays of characters
Abstract Data Types should NEVER prompt the user or read information in All information should be passed from the client program or application
Abstract Data Types should NEVER display error messages but instead supply successfail information back to the calling routine.
Step 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