# Algorithm Based on Morphological Operators for Shortness Path Planning
## 2 Morphological Search Framework
### Search Criterion  
The morphological search criterion uses the dilation and erosion operators to conform to a lattice. The reference (initial state) represents a subgraph that indicates where the trajectory starts in the lattice. All subsequent subgraphs resulting from dilating the reference represent a lattice that denotes all possible paths to search a trajectory. After reaching the destination node, the optimal path trajectory is estimated by following the natural order constituted by the successive dilations and the frequency counters of each dilated node, starting from the destination node to the origin (inverse order). The proposed framework consists of a given graph \(x_{0}\subseteq G\), as the origin, for the location of a path trajectory of connected nodes \(P=\{(n_{1},n_{2}),(n_{2},n_{3}),\,\ldots,(n_{k-1},n_{k})\}\) covered by a two-tuple element \(n_{i},n_{i+1}\in G\) that denotes, under a specific criterion \(C\), the most reliable path to travel from the \(n_{1}\in x_{0}\) node to the destination \(n_{k}\in x^{*}\) node, both in \(G\). The algorithm applies a morphological covering operator starting from the \(x_{0}\) node until successive dilations reach the objective \(D\). The intersection of \(x_{0}\) and \(D\) is usually an empty set \(x_{0}\cap D=\{\varnothing\}\). In terms of semantics, whenever the intersection of both elements becomes a non-empty set \(x_{0}\cap D\
eq\{\varnothing\}\), the starting and destination locations in the graph are the same. The covering dilation generates a graph denoted by \(x^{*}\), such that \(x^{*}\cap(x_{0}\cup D)=x_{0}\cup D\), i.e., the destination \(D\) has been reached via successive dilations  
Figure 2: Covering dilation operator and the frequency with which each node is dilated. starting from \(x_{0}\). The algorithm takes as an input a \(G\) graph space; \(x^{*}\subseteq G\) represents the coverage by dilation to reach destination \(D\subseteq G\) starting from \(x_{0}\subseteq G\), which represents the initial position (or reference); and \(D\subseteq x^{*}\) represents the destination. The last input is a structural graph connection neighborhood. It represents a homomorphic structure for the lattice navigation \(\lambda\subseteq x^{*}\). The algorithm outputs a path that follows the search criterion and the total cost associated with displacement along this path. The complete algorithm is described in Algorithm 1. This algorithm computes the best trajectory under the assumption that there are one or more solutions. In spaces without a solution, the algorithm becomes computationally infeasible. An example in which the covering dilation operator reaches the minimum path trajectory is presented in Appendix A, as well as other complementary consequences of these definitions. The function \(C\) criterion (line 8 of the algorithm) takes as an input a given node \(n\) and a set of adjacent nodes expressed as \(N=\{e_{i}\) such that \((n,e_{i})\in G\}\). The output is the node that denotes the best transition from the current node \(n\) to any node belonging to its neighborhood. The function \(C\) analyzes the neighborhood, selecting the best node (minima or maxima) to construct the path. ```
1:procedureSearchProcess(\(x_{0},D,x^{*},G,\lambda\))
2:\(M\leftarrow\text{cover}_{\lambda}(x_{0},D)\)\(\triangleright\) Iterates covering the search space \(x^{*}\) until the goal \(D\) is reached. 3:\(Mn=||M||\) or \(Mn=|M|\)\(\triangleright\) Cost of traveling across \(\leq_{G}\) order. 4: Starting in any \(s_{i}\in S_{0}\)
5:\(C\gets Mn_{x_{0}}\)\(\triangleright\) Initial cost with the weight of node \(n_{i}\). 6:\(P\leftarrow\{\emptyset\}\)\(\triangleright\) Initial path trajectory. 7:while a node \(n_{i}\in D\) is not reached do\(\triangleright\) Repeat until a solution is found. 8:\(n_{i+1}\gets C(n_{i})\)\(\triangleright\) Advance in the best path according to \(C\). 9:\(P=P\cup\{(n_{i},n_{i+1})\}\)\(\triangleright\) Adds current traveling node. 10:\(n_{i}\gets n_{i+1}\)\(\triangleright\) Further state becomes current state.