Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Project - Graph Traversal

1 Overview

This project requires you to model the problem below as a graph and then use a known graph algorithm to solve the problem (you can pick any algorithm you want).

You must traverse a field of arrows (red or blue). You must find a route from the arrow in the top left corner to the bulls-eye in the bottom right corner. You must follow the direction that the arrows point, and you can only stop on the other colored arrow. For example, start on red, then chose a blue arrow (in the direction that the red arrow is pointing), then from the blue arrow chose a red arrow in the direction the blue arrow is pointing. Continue in this fashion until you find the bulls-eye in the bottom right corner. You may find your-self in a loop and continuously visiting the same arrows. You must find the correct path.

2 Report

You must include a report with your project. It will include the team members names along with their contribution to the project, programming language used (C++ or Java), detailed instructions on how to compile and run your program, and you must also answer the following questions.

a) What type of graph did you use for the problem and how did you construct the graph (what do the vertices, edges, etc. correspond to)?

b) Which algorithm did you use? Describe it in pseudocode.

c) What is the time complexity of your algorithm?

You must implement the programming aspect of this project in either C++ or Java. The only rules for your program are that it must take a text file as input, and write the results of the program to a text file as output. The name of the input and output files need to be given to the program as command line parameters. For example: GraphTraversal input.txt output.txt

Input file format

Your program should read its input from a file with the following format. The input begins with two positive characters on a line indicating the number of rows r and columns c of the maze, respectively. The next r lines contain the color and directional information for each arrow in the maze. Each line has c values, where each value represents the color of the arrow by the direction of the arrow (N, E, S, W, NE, SE, SW, or NW). The color codes R and B represent red and blue, respectively, while the direction codes represent north, east, south, west, northeast, southeast, southwest, or northwest, respectively. The bulls-eye is represented by the letter O. You may assume that the bulls-eye will always be in the bottom-right corner of the maze.

8 8





R-E  Ft-SE  B-S  B-SW  R-S  Ft-SW  Ft-S  Ft-S 
B-E  R-S  B-SE  R-E  B-SE  B-S  B-W  Ft-SW 
R-N  B-W  B-SW  Ft-SE  Ft-NE  B-SW  B-W  Ft-W 
R-SE  Ft-SE  B-SW  Ft-SE  Ft-S  B-NW  R-E  B-NW 
B-NE  R-W  Ft-S  B-S  B-E  B-NE  B-NW  Ft-NW 
R-S  B-SE  R-SE  Ft-SE  R-NW  R-NE  B-E  R-W 
R-NE  B-W  B-SE  R-E  R-E  B-E  B-NW  Ft-SW 
B-NE R-E B-N Ft-NE B-NE B-N B-NW 0

Output file format
You must write the output file in the following format. The output will consist of a path from the top left square to the bottom right square (bulls-eye). Write a single line consisting of a sequence of moves, separated by spaces. Each move should be represented by the number of spaces to move and the direction, with no spaces in between. The direction should be represented using N, E, S, W, NE, SE, SW, and NW, as in the input. The sequence of moves must solve the maze from the input. You will be given multiple mazes to test, along with the solutions so you can check your answers.

For example, if your first 3 moves take you 3 spaces east, 3 spaces southwest, and 4 spaces southeast, your output should begin as follows:
3E 3SW 4SE

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92574835
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Question having a strong statistical picture of data is

Question : Having a strong statistical picture of data is important to being able to properly identify trends in statistical analysis. In R, how can an analyst identify appropriate sample distributions and test for norma ...

Use the information on the market for bicycles to answer

Use the information on the market for bicycles to answer the following questions. Demand: P = -125*Q + 540; Supply: P = 150*Q + 210, where P is the price of bicycle and Q is the quantity demanded or supplied of bicycle. ...

Question suppose we have two binary search trees b1 and b2

Question : Suppose we have two binary search trees B 1 and B 2 Give an algorithm to merge B 1 and B 2 into a single binary search tree, and runs in time linear in the sum of the sizes of the two trees. Give good justific ...

Select two application areas for data mining not discussed

Select two application areas for data mining NOT discussed in the text book and briefly discuss how data mining is being used to solve a problem (or to explore an opportunity)?

Recursive greatest common divisor the greatest common

(Recursive Greatest Common Divisor) The greatest common divisor of integers x and y is the largest integer that evenly divides both x and y. what is a recursive function gcd that returns the greatest common divisor of x ...

Link changes in unemployment inflation wages and gdp to one

Link changes in unemployment, inflation, wages, and GDP to one another and how they impacted each other during periods of economic decline (recessions) and periods of economic growth (expansion) over the past 10 years.

The formulas a rarr b and c and a rarr b and a rarr c are

The formulas A → (B ∧ C) and (A → B) ∧ (A → C) are logically equivalent. For this problem, you are going to prove that they are equivalent in two different ways. Prove that A → (B ∧ C) ≡ (A → B) ∧ (A → C) by writing two ...

Question define four different conflicts you have

Question: Define four different conflicts you have encountered. These conflicts can be work related or personal conflicts. Need in APA Format, 300 words, No Plagiarism. The response must be typed, single spaced, must be ...

Secret channels a company uses public internet to carry its

Secret Channels A company uses public Internet to carry its phone service. The voice data will be encrypted before sending to Internet. The encryption algorithm is as follows: For each four-digit decimal integer, (1) Add ...

Think about a good or service for which you believe there

Think about a good or service for which you believe there has been a shift in demand or supply. Explain the reasons behind the shift and how that has influenced the equilibrium price.

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As