A. Breadth-First Search Algorithm
We start using the Breadth-First (BF) algorithm to obtain
the path. BF is a technique for searching and returning a path
from a given Starting Point to a given Goal Point. The
algorithm guarantees finding a solution, if there exists one. As
for its complexity, it is a linear algorithm with respect to the
number of considered nodes, while the way it searches is
based on maintaining a queue of all neighbors found to be
accessible through means of vertices until the Goal is reached.
Keeping a similar queue, in which for each node we keep the
one from which our node was found as neighbor, makes it
possible to reconstruct the path.
Given a random map of the environment, that respects the
criteria mentioned above, a Starting Point and a Goal Point,
the implementation of BF will return (if there exists) a valid
path between the two points. The path will be marked,
assuming that one can pass only through the free spaces and
the directions of motion are only the ones stated. The
algorithm is presented in Listing 1.
The reconstruction of the solution is done by means of a
special routine, which takes the list of previous elements and
reconstructs the visited points of the map (Listing 2)
A. Breadth-First Search Algorithm We start using the Breadth-First (BF) algorithm to obtainthe path. BF is a technique for searching and returning a pathfrom a given Starting Point to a given Goal Point. Thealgorithm guarantees finding a solution, if there exists one. Asfor its complexity, it is a linear algorithm with respect to thenumber of considered nodes, while the way it searches isbased on maintaining a queue of all neighbors found to beaccessible through means of vertices until the Goal is reached.Keeping a similar queue, in which for each node we keep theone from which our node was found as neighbor, makes itpossible to reconstruct the path.Given a random map of the environment, that respects thecriteria mentioned above, a Starting Point and a Goal Point,the implementation of BF will return (if there exists) a validpath between the two points. The path will be marked,assuming that one can pass only through the free spaces andthe directions of motion are only the ones stated. Thealgorithm is presented in Listing 1.The reconstruction of the solution is done by means of aspecial routine, which takes the list of previous elements andreconstructs the visited points of the map (Listing 2)
การแปล กรุณารอสักครู่..