I have never encountered logistics, only in theory at the institute. Imagine a lot of points connected by lines. Points WITHOUT coordinates (x, y, z). Dots have names - these are points of unloading, loading, and the lines connecting them are mashruts. To get a route you need to set the starting point and the final one. And the program already gives the number of waypoints and their names. Here is an example: Map with points
And the question is how to properly store these relationships in the database so that I can effectively route and have an idea of the number of points being crossed?
I tend to the method that you first need to create a table of unique point names with id PRYMARY AUTO_INCREMENT
Then do something like
SELECT t1.`name`,t2.`name` AS `second_name` FROM `table` t1 FULL JOIN `table` t2 ON t1.`name`!=t2.`name` and check if there is a connection between them, if there is, then write many to many in a table (a pair, like their id in a couple of columns)
Or go the other way and check how many dots between them and determine their id
The first method is flexible, since it will be possible to choose routes. And the second one is faster - it gives an unambiguous option and you don’t need to count anything, only if you need non-linear routes but with races to the neighboring ones, then I don’t know what some formula will be needed either.
In the first case, I will have to build two trees with linked branches, where their bases are the starting and ending points, all the linked branches are paths, and the shortest path is the desired one.
If someone faced with such tasks - tell me where to look for information.
Thank.