Bletchleyite
Veteran Member
Putting in a new speculative thread to delve into this more.
Station from
Station to
List of permitted via stations
That's the data you need. You basically stop when you get to a via station that doesn't offer a drill down, which would be a station pair where there is only one route on which a passenger service operates.
You would need something to stop it looping, e.g. if you had Stockport-Euston valid via Manchester and Manchester-Euston valid via Stockport. The logic for that isn't immediately straightforward, but it's a case of "don't explore a route that has already been explored".
@Bletchleyite how would you intend to express the valid routes in a file? Would you apply a limit to the depth of recursion? Otherwise you would end up with cycles.
Station from
Station to
List of permitted via stations
That's the data you need. You basically stop when you get to a via station that doesn't offer a drill down, which would be a station pair where there is only one route on which a passenger service operates.
You would need something to stop it looping, e.g. if you had Stockport-Euston valid via Manchester and Manchester-Euston valid via Stockport. The logic for that isn't immediately straightforward, but it's a case of "don't explore a route that has already been explored".