Apply the bfs algorithm and show the output

Assignment Help JAVA Programming
Reference no: EM13825347

Problems:

Depth-first & breadth-first search

The textbook shows algorithms for Depth-First Search (DFS) and Breadth-First Search (BFS) applied to tree structures. Now we extend the algorithms to graph structures.

In our definition, BFS is a graph search algorithm that begins from a node (a "root" node) and explores all the neighboring nodes. Then for each of those nearest nodes, it explores their unexplored neighbor nodes, and so on, until all the nodes within the graph are explored.

DFS is a graph search algorithm that starts from a node (a "root" node) and explores as far as possible along each branch before backtracking (going back to a node that has been explored before). For an undirected and connected graph, such a process could produce a Depth-First Search Tree, in which the starting node serves as the root of the tree. Whenever a new unvisited node is explored for the first time during the DFS search process, it is attached to the DFS tree as a child to the node from which it is being reached.

Please note that our BFS and DFS algorithms are defined in a traditional way. The algorithms shown in the textbook try to find a goal node. In our algorithms, we are trying to explore all the nodes within the graph.

Please use the Figure 1 and answer the questions. The figure shows an undirected graph and all the edges have equal costs (e.g., the lengths of all edges are equal). For simplicity, when wehave a number of alternate nodes to explore, we will select them in an alphabetical order. The problems can be easily solved by hand.

Assume node a is the starting point (the "root" node) from which the search starts.

1872_Algorithm for Depth-First Search.png

1) Apply the BFS algorithm and show the output (list all the nodes by the order they are being explored)

2) Apply the DFS algorithm and show the output (list all the nodes by the order they are being explored)

3) Show the output from the previous question in the form of a DFS tree.

2.2: A* Search
Note: This is a programming problem. You are required to write your own program to solve the problem, but it is free to choose any programming language you feel comfortable with. You are not required to include your source code in your submission. Please include a brief discussion on how the experiments are conducted (e.g., the data structures used, parameters you choose for the algorithms, etc), and how you get your solutions for each of the questions. Please note that you need to describe important assumptions based on which your solutions can be derived.
The problem is described as follows. Consider an idealization of a problem where a robot has to navigate its way around obstacles. The goal is to find the shortest distance between two points on a plane that has convex polygonal obstacles. Figure 2 shows an example scene with seven polygonal obstacles where the robot has to move from the point start to the point end. Convince yourself that the shortest path from one polygon vertex to any other in the scene consists of straight-line segments joining some of the vertices of the polygon. (Note that the start and the end goal points may be considered polygons of size 0).
1) Suppose the state space (i.e., a set of possible locations for the robot) consists of all possible positions (x, y) in the plane. How many possible states are there? How many paths are there to the goal? Provide important assumptions for your answer.
2) Based on your solution for 1), can you find a better (and reasonable) state space for the problem? If the answer is yes, how large is the state space? If the answer is no, provide justifications why you think this is a good state space to implement your following searching algorithm.
3) Implement an algorithm to find the shortest path from the start node to the end node using an A* (A-star) heuristic search. Use the straight-line distance to the end node as a heuristic function. Show your pseudo code for this algorithm. Is this an admissible heuristic function? Why or why not?

Hint: Define the necessary functions to implement the search problem. This should include a function that takes a vertex as input and returns the set of vertices that can be reached in a straight line from the given vertex. You may need to implement a function that detects whether or not two line segments intersect. The problem can be easily solved using shortest path algorithms but you are required to use A*.

4) Present the solutions for the following problem using the A* algorithm you implemented.

1846_Algorithm for Depth-First Search1.png


Polygon 1: ((220, 616), (220, 666), (251, 670), (272, 647))
Polygon 2: ((341, 655), (359, 667), (374, 651), (366, 577))
Polygon 3: ((311, 530), (311, 559), (339, 578), (361, 560), (361, 528), (336, 516))
Polygon 4: ((105, 628), (151, 670), (180, 629), (156, 577), (113, 587))
Polygon 5: ((118, 517), (245, 517), (245, 577), (118, 557))
Polygon 6: ((280, 583), (333, 583), (333, 665), (280, 665))
Polygon 7: ((252, 594), (290, 562), (264, 538))
Polygon 8: ((198, 635), (217, 574), (182, 574))
Start: (120, 650) End: (380, 560)


Note: This figure is for illustration purpose only. Positions of the polygons inside the figure may not reflect their actual coordinates.

5) Is it possible to solve the problem using a breadth-first or a depth-first search algorithm? If the answer is yes, briefly discuss your solutions. Otherwise please explain.

Verified Expert

The solution file contains JAVA_Solution.docx document file, Robot.java programming file, and output screenshot of program.. Its running program with description and logic. There will be infinite number of states and paths when the state space is (x,y). We define our world like this: Given the world W = < 2 (the real plane) and a finite group of convex polygonal obstacles O, our goal is to move an agent (represented as a point) from an initial position (xs, ys) to a final position (xg, yg), such as the path is the shortest 4 possible...

Reference no: EM13825347

Questions Cloud

Importance of product cost information : This question here belongs to Accounting and it is about absorption costing and marginal costing. An example of Reebok has been given in the solution
Own personal statement or comment : In my ten years of experience I have encountered and worked with four different types of pallets. I have worked with 463L pallets which are strictly used for air planes with a locking rail system. I have also worked with three different types of ware..
Case study analysis: sun and sand sports : Case Study Analysis: Sun and Sand Sports
Where does congress get the power to enact civil rights : Where does Congress get the power to enact civil rights legislation?  If that right is not specifically enumerated in the constitution, how can we know that protection of civil rights - specifically the prohibition against discrimination
Apply the bfs algorithm and show the output : Apply the BFS algorithm and show the output and Apply the DFS algorithm and show the output - Define the necessary functions to implement the search problem. This should include a function that takes a vertex as input and returns the set of vertice..
Where the market price and total cost including fixed cost : The problem related to Economics, Micro-economics and it is clarifying the problem where the market price and total cost including fixed cost to produce an output has been given.
Current state of interest rates : Write a 150 word paragraph for each item below: - Current state of consumer income  - Current state of interest rates
Considering getting in the auto rental business : An auto garage is considering getting in the auto rental business. It is considering purchasing 100 new automobiles at a total cost of $2,000,000. It is estimated that the purchase would increase revenues by $900,000 the first year and by $1,000,000 ..
Dormant commerce clause : What does the Dormant Commerce clause provide?  How does it apply to states' ability to make laws?  Include proper in-text citations in APA format to support your answer.

Reviews

tlb825347

8/26/2016 12:02:28 AM

Thanks for solution, i got it high graded solution, appreciated by my professor. Thanks for your help.

tlb825347

8/26/2016 12:01:38 AM

Yes, i know the code is having many errors, tutor is required to resolve the error and provide appropriate solution for program with output. Thanks for your effort..Please provide me quick solution with high standard..

tlb825347

8/26/2016 12:00:27 AM

Professor wants a program written for it. I have the code but it is not working properly. Please provide the solution according to requirement. 7773495_1Code for robot.docx 7773482_2AI.java

Write a Review

JAVA Programming Questions & Answers

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Constructor that initializes the three automatic properties

Create a class called Date that adds three pieces of information as automatic properties-a   month (type int), a day (type int) and a year (type int).

  Prepare a java program to create a gui

Prepare a java program to create a GUI and show the picture of the zodiac. Be sure to include comments. The comment should describe the purpose of the program and the data to be entered.

  Create class named horse

in Java Create a class named Horse that contains data fields for the name, color, and birth year. Include get and set methods for these field. Next, create a subclass named RaceHorse, which contains and addtional field that holds the number of rea..

  Assignment 1java tic-tac-toe game assignment 1 is

assignment 1java tic-tac-toe game assignment 1 is attachedattachment-nbsptic tac toe game.docxthis assignment consists

  Program that allows two players to play tic-tac-toe

Implement a program that allows two players to play tic-tac-toe. Draw the game grid and an indication of whose turn it is (X or O). Upon the next click, check that the mouse click falls into an empty location,

  Evaluate total annual compensation of a salesperson

Write a Java application using NetBeans Integrated Development Environment (IDE) that calculates the total annual compensation of a salesperson. Consider the following factors: A salesperson will earn a fixed salary of $45,000

  Quadratic that solves quadratic equations

Write a method called quadratic that solves quadratic equations and prints their roots. Recall that a quadratic equation is a polynomial equation in terms of a variable x of the form ax2 + bx + c = 0. The formula for solving a quadratic equation is ?..

  Details of all advertisers registered with the service

Create a list of 6-7 different customers of both types with made-up details built in to the client program - display the details of all advertisers registered with the service,

  Determine java application on web and structure functions

Determine the Java application on Web and explain how program structure functions. Explain the application in as much detail as possible.

  Write a program that creates two string arrays

Write a program that creates two String arrays, one to store names of 5 boys and another to store names of 5 girls

  Statements to print a label

Add the statements to print a label in the following format (the numbers in the example output are correct for input of $4.25 per pound and 41 ounces). Use the formatting object money to print the unit price and total price and the formatting object ..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd