Assignment title: C++


The project is broken up into a number of tasks, to help you progressively complete the project. Figure 1: User-movie bipartite graph example. The yellow coloured circles represent the users, and the blue coloured represent movies. The clear squares next to each circle represent the integer based identifier used in an implementation example later, and uniquely identifies each vertex. Note that the vertices in different partites may have the same identifiers but within each partite the identifiers should be unique. Also the identifier labels do not have to be sequential, the only requirement is they form a set. This graph is in its current state after a number of vertex insertions and deletions. Task A: Implement Bipartite Graph (8 marks) In this task, you will implement the (directed) bipartite graph abstract data type using a number of graph structures, namely adjacency list, adjacency matrix and edge list (bonus) representations. Your implementation should support the following bipartite graph operations: • Create a bipartite graph, either an empty graph or with a fixed number of vertices. • Delete a bipartite graph. • Insert a vertex. • Insert an edge. • Search for a vertex. • Search for an edge. • Delete a vertex. • Delete an edge. Notes: • Your implementations should give exactly the same output as the provided implementation. • The implementation details are up to you, but you must implement your own data structures and algorithms. • All submissions should be ANSI C (C99 standard) compliant, and should compile with no warnings with "-Wall -ansi -pedantic" flags. If you develop on your own machines, remember to periodically compile and run your code on university machines (e.g., titan.csit.rmit.edu.au, jupiter.csit.rmit.edu.au, saturn.csit.rmit.edu.au), as you don't want to find out last minute that your code doesn't compile on these machines. • You may alter the provided code, but remember to generate the same output format as the provided main.c. Details Each of the graph structures can be implemented using a number of data structures. We provide an array-linked list implementation of the adjacency list to help you get started. You are to implement the following graph structures using the specified data structures: • The adjacency list representation, using a linked list-linked list implementation. • The adjacency list representation, using a binary search tree (partially implemented)-linked list implementation. • The adjacency matrix representation, using an array-array implementation. Operations to the bipartite graph ADT are provided in the input files, which are text files providing lists of operation commands to execute. They are in the following format: where command is one of {C, D, I, R, S, P} and sub-command is one of {V, E, X} and arguments take the following form: • C X 0 0 – create an empty graph. • C X – create a graph, with 'vertNum1' number of vertices in the first partite, and 'vertNum2' number of vertices in the second partite. If vertNum1 or vertNum2 are greater than 0, then the created vertices should have ids starting from 0. For example, if vertNum1 = 3, then the created vertex should have ids '0', '1', and '2'. • D X – destroy the graph. • I V – insert vertex 'vid' into the partite 'part' of the graph. • I E – insert edge '(sid, tid)' into the graph, with the partite 'srcPart' to be the source one. • S V – search for vertex 'vid' in partite 'part' of graph. • S E – search for edge '(sid, tid)' in the graph. • R V – delete vertex 'vid' from the partite 'part' of the graph. • R E – delete edge '(sid, tid)' from the graph. • P X – prints the current bipartite graph. Partite ids should be '1' or '2'. For the desired output of print, it should be in the following format (see the linked list implementation in bpGraphAdjList AL.c for an example): V e r t i c e s : Part 1 : Part 2 : Edges : Part 1 t o 2 : Part 2 t o 1 : As an example, if P X was executed for the graph of Figure 1, the following output should appear (remember the graph in the example is an undirected graph, which can be represented as edges going in both directions in a directed graph representation): V e r t i c e s : Part 1 : 0 1 2 Part 2 : 0 3 4 6 Edges : Part 1 t o 2 : 0 0 0 4 1 3 1 6 2 0 2 3 2 6 Part 2 t o 1 : 0 0 0 2 3 1 3 2 4 0 6 1 6 2 Task B: Evaluate your Data Structures (7 marks) Write a report on your analysis and evaluation of the different implementations. In particular, focus on the differences in time among the implementations when executing the basic operations, and also how much space each data structure uses. Consider in which scenarios each type of implementation (adjacency list, adjacency matrix and edge list if implemented) would be most appropriate, and subsequently which data structures you recommend to implement those in. The report should be 4 pages or less. See the assessment rubric (Appendix A) for the criteria we are seeking in the report. Bonus Task: Implement