

![0_image_0.png](0_image_0.png)

## Algorithm-6: Start Point Node In The Map

![0_Image_1.Png](0_Image_1.Png) E. Finding The Shortest Path

The Idea of this algorithm is to find the possible shortest path between start and end points. In order to give the intelligent robot the required knowledge from the blueprints to sweep a building, the shortest path starting from StartPoint ending with EndPoint should be found in order to decrease the time that is needed for sweeping the targeted building. This Algorithm contains connected sub algorithms, which are described in next sections.

## F. Creating Graph (Connecting Nodes)

As a result from the previous step, a collection of nodes have been extracted from the blueprint map. Each node must be connected to its neighbors, so that the nodes are in sets as a network, each node with its neighbor (i.e. (node1, node3), (node1, node4), (node2, node3) …).

Algorithm take the current pixel (initially it is the node itself), put it in a variable, then take one of its eight neighbors, if one of this pixel's eight neighbors is a node, then it finishes its job and return the node, otherwise, it takes the other neighbor from the eight neighbors of the pixel, if this pixel is not the same as the variable then it is set as the new variable, and checked for next neighbor again until next node is reached or a node with only one neighbor that is tagged in the variable, this means that a closed path reached. Two Cases are shown in Fig. 8.

![0_image_3.png](0_image_3.png)

In order to find the neighbors, as shown in Fig. 9, each node boarder pixel labeled previously (including start and end points) is put in a function along with the node itself as a pixel that returns a node neighbor from one direction. 

Fig. 9: Connecting Nodes.
In the case of finding the neighbor node, the distance between the two nodes is calculated and returned within the set 
(i.e. (node1, node3, 50), (node1, node4, 150), (node2, node3, 70) …), as seen in algorithm 7.

//finding shortest path
//nodes with its neighbors (connecting Nodes)
//For each node in the array of nodes find its neighbors 
//of nodes and the distance between them for each node for each node neighbor if color(neighbor) = 000000 then if getNextNode(node, neighbor) not in connectNodes[i] then connectNodes[i] = getNextNode(node, neighbor)
 end if end if end for end for
//get next node function get the node and

![0_image_2.png](0_image_2.png)

## G. Floyd'S Algorithm

This algorithm has been previously declared as ―It determines the shortest route between any two nodes in the network [20]. The algorithm represents an n-node network as a square matrix with n rows and n columns. Entry (~j) of the matrix gives the distance d ij from node i to node j, which is finite if the i is linked directly to j, and infinite otherwise‖. The algorithm finds the shortest path in a network of nodes. As it is build it takes the sets of nodes, where each node is put within its neighbor node along with the distance (weight) between the two nodes, also start and end points must be specified according to the flowchart in Fig. 10. 

The algorithm 8 has been edited in this project to match on going algorithms, because the original one assumes directed paths, where no directed paths are considered in navigation.