HubbleCommand.github.io

Personal blog, project documentation, and ramblings

Railway Math

Posted 03 Dec 2025

tags: math

I recently watched these two videos on trains and the scheduling math behind them.

The rail graphs really intrigued me. Any physical and temporal resource allocation problem is really interesting, as long as it’s not meeting scheduling. (insert tears for the nightmare that is ms teams scheduling) I was mostly surprised that ‘train graphs’ weren’t a thing much earlier. Given that it didn’t seem that hard to implement, I made the following very basic implementation. It only allows for the following things:

  • enter stations names
  • register trains with:
    • a start station
    • an end station
    • a start time
    • an end time

It will then draw the network, and determine any crossovers. This doesn’t allow setting individual station departure times or station layovers / delays. It ain’t pretty, but that’s not the point of it, is it.


Stations

    Trains