Text this: A Graph-Theoretic Approach to the Train Marshalling Problem