Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Please do all requirements listed and make sure the code is accurate with the examples posted below! PLEASE MAKE SURE THE CODE GOES WITH

C++ Please do all requirements listed and make sure the code is accurate with the examples posted below! image text in transcribedimage text in transcribed

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed image text in transcribed PLEASE MAKE SURE THE CODE GOES WITH THE EXAMPLES ABOVE!

a. Create a function to initialize the matrix (sample matrix data is listed below) d=4;m1={{1,1,1,0},{1,1,0,1},{1,0,0,0},{0,1,0,1}};d=3;m1={{1,1,0},{0,1,0};{1,0,1}};d=2;m1={{1,0},{0,1}}; b. Allow the user to pick which of the 3 dimensions they prefer and use that matrix to see if it is reflexive, symmetric, transitive, and to find the transitive closure. To do this, create the functions: Create a function to print the matrix given Create a function to add two matrices together (you will be using the same matrix 2 times) Create a function to square the matrix given Create a function to check if the matrix is reflexive (if all values on the diagonal are 1) Create a function to check if the matrix is symmetric (values are equal across the diagonal) Create a function to check if the matrix is transitive (not transitive if there is a non-zero in the squared matrix that is zero in the original matrix) Create a function to find the transitive closure of the matrix (continue to multiply the matrix by itself up to the number of dimensions and keep a running total of the sum of all of these matrices) a. Create a function read an input file (see data.txt for input example). Add the code to read the matrix size \& load the elements of a matrix (in row-major order) from a file, reading \& processing multiple matrices and outputting the results b. Prompt to see if user would like to verify a path. If so, allow user to enter a starting value and ending value to determine if a path exists from the starting point to the ending point (if the coordinate point in the transitive closer is non-zero, there is a path from i to j(i,j). a. Be sure to comment code b. You must use functions (.h and .cpp files) for the functions listed above the type of input to use: ile se set values: your choice: 1 vector dimension (2-4) do you prefer? 4 urrent matrix is: The matrix is not reflexive The matrix is symetric The matrix is not transtive The result of the matrix to the power of 2 is: The result of the matrix to the power of 3 is: 6633672532113514 The result of the matrix to the power of 4 is: 1515691518612663391239 Example 2 (from matrix in data.txt) The matrix is not reflexive The matrix is not symmetric The matrix is not transtive The result of the matrix to the power of 2 is: 1000101110010111 The result of the matrix to the power of 3 is: 1000111110111112 The result of the matrix to the power of 4 is: Bonus Example (Route Checking) lould you like to check routes? (Y if so): Y oreatl Enter values between 0 and 3: Enter the starting value: 2 Enter the ending value: 0 There is not a path between 2 and 0 ! lould you like to try again (Y): Y Great! Enter values between and 3: Enter the starting value: 2 Enter the ending value: 2 There is a path between 2 and 2 ! data.txt 41100001000010101311001010121001

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions