Question Details

(solution) Write a program called FindPath.java to solve the following


Write a program called FindPath.java to solve the following problem.

The program will be given an input consisting of a series of positive integers separated by white space representing a directed graph as follows.


There will always be an even number of integers in the input, and you may assume that input will consist of at least two integers and is of the form specified. It is not necessary to code for nonsense input files or nonsense command lines when running your program. The input is to be regarded as a series of pairs of integers. Each integer represents a node in the graph, and each pair represents a directed edge in the graph, from the first element of the pair to the second element of the pair.


The graph represented by the input will have at most 10,000 nodes, which you may assume to be numbered from 1 to the maximum integer in the input. Note that it is not necessary for a node to have any edges attached to it, in which case it will not occur in the input file.Here is a sample input file.


The program should exhibit detailed behavior exemplified as follows, where the message will indicated whether or not there is a path between the specified pair of nodes in the graph, and is an error message if any number supplied on the command line is not a node in the input data.


You may freely use any of the machinery to represent graphs and compute with graphs developed in class, however, you may NOT use any classes that come with Java apart from those used in teaching this class.


$ java FindPath 22 92 < input.txt

There is a path from node 22 to node 92


$ java FindPath 119 92 < input.txt

There is no path from node 119 to node 92


$ java FindPath 119 225 < input.txt

There is no node 225

 


Solution details:

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Sep 13, 2020

EXPERT

Tutor

ANSWER RATING

GET INSTANT HELP/h4>

We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

  • As a reference for in-depth understanding of the subject.
  • As a source of ideas / reasoning for your own research (if properly referenced)
  • For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

NEW ASSIGNMENT HELP?

Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.

WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN A DEADLINE.

Order Now