The article discusses an approach aimed at the development of algorithmic support for unmanned aerial vehicles. This is due to the construction of a flight task based on the optimality criterion for solving the problem of processing fields in precision farming. The shortest path criterion is used in the implementation of the UAV flight plan with a complex trajectory and frequent course changes. Dijkstra’s algorithm is considered as an algorithm that implements this criterion. The article provides an example of calculating a segment of a network of objects, notes the simplicity of the calculations of the algorithm. Suggestions on the use of this algorithm in the construction of a flight task are given.