Answer the question
In order to leave comments, you need to log in
Can a 3D matrix be represented by a graph?
Colleagues, the question may be naive, but help me figure it out. Suppose I have a three-dimensional array, one dimension of which will store longitude, the second latitude, and the third time. That is, I save events in such an array (where, when). This way I can select two arbitrary cells and calculate the distance between them and the time difference between the two events.
I have a task, between two selected events (longitude, latitude, time), to find the shortest route from the events that occurred in the interval from the first to the second event. It intuitively reminds me of a graph for which algorithms have already been developed for this task. But due to my poor knowledge in this area, I cannot understand whether such data can be represented as a graph. Maybe some other solution is needed?
Answer the question
In order to leave comments, you need to log in
You can imagine.
But in order to apply pathfinding algorithms on a graph, you need to consider any two records connected, that is, the number of edges will grow quadratically from the number of records and, it seems to me, you will get a very high computational complexity.
On the other hand, the measurement of time "works for you", cutting off events earlier than the first and later than the second. And if in the time interval between the events that you are trying to connect, there are only 10-20-50 intermediate events in the database, then perhaps algorithms on graphs will suit you.
Yes, you can in principle. Each event corresponds to a vertex of the graph. An arc goes from vertex A to B if event B occurred after A. The weight of arcs is the distance calculated from the coordinates of the event. If, for example, several events occurred at one point, then this will correspond to several vertices in the graph, the arcs between which will be with zero weight.
When drawing up the graph, use only those events that fall into the boundary conditions for the time of your task.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question