Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MUST USE named files to handle I/O. There will be a penalty for hardcoded file names. Use Java as the programming language Here is the

image text in transcribed

MUST USE named files to handle I/O. There will be a penalty for hardcoded file names. Use Java as the programming language

Here is the input.txt file:

4 0 1 1 0 1 1 1 1 1 0 0 0 1 1 0 1 6 0 1 0 1 1 0 1 0 0 1 1 0 0 0 1 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 1 3 0 1 1 1 0 1 1 1 0
The diagram below is an example of a directed graph. Each edge has an arrow denoting its direction Node B is considered adjacent to node A if there is a directed edge from A to B. A will only be adjacent to B if there is also an edge from B to A. It is possible to associate a matrix called the adjacency matrix with a graph. Adj[ = 1 if and only if there is an edge from node i to node j in the graph. If AdjN] = 0 then there is no edge from node i to node j. (You may find it helpful to review the chapter in the text on graphs). We will assume that our adjacency matrices contain only 1's or O's In a graph, one is usually interested in the possible paths from one node to another. The ones which are the most useful are the ones which do not contain loops (cycles), i.e.. do not visit a node more than once. The node sequence 1 2 4 is an example of a path with no loops. 1224 1 3 is an example of a with a cycle and a loop. An allowable exception is for the starting and ending node to be the same. 1 2 1 is OK but not 12 1241 "To Nodes" 0 11 0 Adjacency "From 11 1Matrix Nodes" 1 0 0 0 Write a program to read in the number of nodes in the graph and the corresponding adjacency matrix, one row at a time. Echo the adjacency matrix to your output file. The program should use recursion to find and list all possible non-looping paths between all possible pairs of nodes. It is ok if the start and end nodes are the same but otherwise the nodes should not repeat within the path. If no path exists for a particular pair of nodes then print 'No Path Found'. Check out all possible paths in each graph. See the attached file for the required input. Make up some other graphs as additional input. You will lose points for having insufficient l/o The recursion is the most important part of this assignment. Use an array to store the adjacency matrix. Consider why it is appropriate. You may not use ArrayLists. Consider an iterative solution as part of your analysis. What impact would that have on your data strucutres Remember, you are responsible for showing that your program does all that it is supposed to do. If you put in any special features, you need to have an I/O set which demonstrates the features Your program should read an adjacency matrix from the file and process the graph to find all the paths, then read an new adjacency matrix, until the file is empty. Make sure to allow for reasonable error situations The diagram below is an example of a directed graph. Each edge has an arrow denoting its direction Node B is considered adjacent to node A if there is a directed edge from A to B. A will only be adjacent to B if there is also an edge from B to A. It is possible to associate a matrix called the adjacency matrix with a graph. Adj[ = 1 if and only if there is an edge from node i to node j in the graph. If AdjN] = 0 then there is no edge from node i to node j. (You may find it helpful to review the chapter in the text on graphs). We will assume that our adjacency matrices contain only 1's or O's In a graph, one is usually interested in the possible paths from one node to another. The ones which are the most useful are the ones which do not contain loops (cycles), i.e.. do not visit a node more than once. The node sequence 1 2 4 is an example of a path with no loops. 1224 1 3 is an example of a with a cycle and a loop. An allowable exception is for the starting and ending node to be the same. 1 2 1 is OK but not 12 1241 "To Nodes" 0 11 0 Adjacency "From 11 1Matrix Nodes" 1 0 0 0 Write a program to read in the number of nodes in the graph and the corresponding adjacency matrix, one row at a time. Echo the adjacency matrix to your output file. The program should use recursion to find and list all possible non-looping paths between all possible pairs of nodes. It is ok if the start and end nodes are the same but otherwise the nodes should not repeat within the path. If no path exists for a particular pair of nodes then print 'No Path Found'. Check out all possible paths in each graph. See the attached file for the required input. Make up some other graphs as additional input. You will lose points for having insufficient l/o The recursion is the most important part of this assignment. Use an array to store the adjacency matrix. Consider why it is appropriate. You may not use ArrayLists. Consider an iterative solution as part of your analysis. What impact would that have on your data strucutres Remember, you are responsible for showing that your program does all that it is supposed to do. If you put in any special features, you need to have an I/O set which demonstrates the features Your program should read an adjacency matrix from the file and process the graph to find all the paths, then read an new adjacency matrix, until the file is empty. Make sure to allow for reasonable error situations

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

Define employer choice strategy.

Answered: 1 week ago

Question

Differentiate between hard and soft measures of service quality.

Answered: 1 week ago

Question

Be familiar with the different perspectives of service quality.

Answered: 1 week ago