当前位置:天才代写 > C++/C代写,c语言代写代考-100%安全,包过 > Computing Structures代写 Project代写 matrix代写 store graphs代写

Computing Structures代写 Project代写 matrix代写 store graphs代写

2020-11-13 18:01 星期五 所属: C++/C代写,c语言代写代考-100%安全,包过 浏览:1311

Computing Structures代写

DSA 5005 – Computing Structures – Fall2019

Computing Structures代写 CSR: A rectangular array of numbers is called a matrix. Sometimes a matrix is referred as a table, 2-dimensional array

Project 2 – Due on October 19th 2019

Introduction: Computing Structures代写

CSR: A rectangular array of numbers is called a matrix. Sometimes a matrix is referred as a table, 2-dimensional array, or array of arrays. Consider the following matrix below. It has 5 rows (denoted n) and 8 columns (denoted m). As you can see the row and column numbers start with a 0.

Computing Structures代写
Computing Structures代写

The empty cells have the same common value (it can be assumed as 0). The above matrix is said to be sparse because the total number of common values is significantly large in comparison to other non-common values in the matrix. In the example above, we have a total of 40 values in the matrix (8 ´ 5), 10 non-common/zero values, and 30 common values.

You can store such a sparse matrix in different formats which will lead to less space complexities. The one method which we are going to be implementing here is called the Compressed Sparse Row(CSR) format. In this format, the matrix n x m is stored in 3 one dimensional arrays – valueArray, IA and JA.Computing Structures代写

  • valueArray – contains all the non-common values; this array will be of length numNZV which is the number of non-common/non-zero values present in the given inputmatrix
  • IA – contains the cumulative number of non-common values in arow
  • JA – contains the column number of the non-common value present; length isnumNZV

Let us take the example from above and walk through this.Computing Structures代写

valueArray = [100, 900, 500, 200, 300, 400, 800, 200, 1600, 700]

IA = [0, 3, 5, 7, 8]

JA = [0, 3, 5, 4, 7, 1, 6, 2, 0, 4]

You can find more information and explanation on this link: https://en.wikipedia.org/wiki/Sparse_matrix

Computing Structures代写
Computing Structures代写

Graph and matrix correlation: Computing Structures代写

A very popular data structure to store graphs is by using matrices called the Adjacency Matrix. The values in the matrices are the edge weights connecting the vertex from the corresponding row number vertex to the column number vertex. Edge existence is to determine whether there exists an edge between the vertices given.

GetNeighbours should get all the neighbours of the node given to the method. You are also required to do a Breadth First Search and a Depth First Search on the given start node – you are required to save the sequence of this BFS and DFS on an array and return it(hence the return type for the methods is int*). You are allowed to use the queue and stack stl libraries for the implementation of these two methods. You can find more information about this in Chapter 11.5 from the book and also the videos that will be released.Computing Structures代写

Implementation note: All these graph operations have to be done directly on the CSR data structure(3 one dimensional arrays) and you are not supposed to un compress the data structure into a matrix for these operations.

On a higher perspective, in this project, you will create appropriate C++ classes (given in sampleMain.cpp) to create the compressed sparse matrix representation data structure and do the graph operations(edge existence, getNeighbours, DFS and BFS) on the compressed sparse row matrix.

Your project implementation:

As part of this project, you will create a class names CSR as given in sampleMain.cpp. This class will have the fields which we used above to store the matrix and also other methods necessary. A sampleMain.cpp(the following code) is also given to you along with this description.Computing Structures代写

Input: You must ensure that your program outputs the output in the exact format provided in the sample outputs. The input file will be of the following format:

5 8 10 // <- numRows, numCols and numNZV

// <- entire input matrix

1600 0 0 0 700 0 0 0

0 3 // <- vertices for edge existance

2 // <- vertex for getNeighbours

1 // <- start vertex for BFS and DFS

The first line reads – 5 rows, 8 columns and 10 being the number of non-sparse values in the matrix. You are also required to overload the ostream operator to display the matrices in matrix format from the CSR object. Example inputs for the above given program have been posted in canvas under the Project 2 tab.Computing Structures代写

Submission: The code must be submitted in GradeScope(more instructions on this will be made as an announcement) where they will be auto graded with the sample set of inputs and outputs and will be officially graded later with more exhaustive input files.

There is a sample hello world auto grader project setup on GradeScope for testing purposes, please go ahead and upload a HelloWorld program there. You need to print this exactly – “Hello World!” followed by a new line. And your file has to be named as ‘helloworld.cpp’. This is a test, so please upload asap and make sure it works. You should past test case 1.Computing Structures代写

Redirected Input:

Redirected input provides you a way to send a file to the standard input of a program without typing it using the keyboard. To use redirected input in Visual Studio environment, follow these steps: After you have opened or created a new project, on the menu go to project, project properties, expand configuration properties until you see Debugging, on the right you will see a set of options, and in the command arguments type <“input filename”. The < sign is for redirected input and the input filename is the name of the input file (including the path if not in the working directory). A simple sample program that reads a matrix can be found below.Computing Structures代写

#include <iostream> using namespace std; int main ()

{

int r,c,cv,nsv; int val;

cin >> r >> c >> nsv;

for (int i=0; i < r; i++) {

for (int j=0; j < c; j++) { cin >> value;

cout << value <<  “;

}

endl;

}

return 0;

}

Constraints:
  1. In this project, the only headers you will use are #include <iostream>, #include<queue> and#include<stack>.Computing Structures代写
  2. None of the projects is a group project. Consulting with other members of this class on programming projects is strictly not allowed and plagiarism charges will be imposed on students who do not follow this.
Computing Structures代写
Computing Structures代写

更多其他:C++代写 r代写  考试助攻 C语言代写 finance代写 lab代写 计算机代写 code代写 report代写 代写CS  project代写 物理代写 数学代写 java作业代写

合作平台:天才代写 幽灵代写 写手招聘 Essay代写

 

天才代写-代写联系方式