I have a somewhat complex problem, on the one hand I have a list that contains lists. These contain integers that represent positions on a map:
rutas = [[0,1,2,3],[0,1,2],[7,4,8],...[5,6],[0,1,3,4]]
I also have another list, which contains, according to its position in the list, the coordinates of each of these integers and a third value that says if it is an entry, exit or intermediate point.
mu = [[12,13,'ent'],[15,-3,'sal'],...[67,0,'med']]
Therefore mu[0]
, corresponds to the integer 0 in rutas
.
What I try to do but I can not find is to find in rutas
, sequences of numbers that go from an 'ent' to a 'salt' and be able to plot them. I explain myself better with an example.
Suppose that the point 0 es 'ent'
and that 4 y 3 son 'sal'
, among others ...
I want to be able to find in routes, those sequences that go from 0 to 4 and from 0 to 3, regardless of whether 0 is the first value in routes and 4 or 3 the last. That is, even being in the middle of the list. And also if I have a route that is: [0,1,2,3]
and another that is [0,1,2]
that the latter account as if it belonged to [0,1,2,3]
.
The idea is then once I have selected all the paths that go from ent -> sal
to plot the corresponding mu coordinates.
If at least you know how to approach it or if there is a function that can help.