Pretty generic directed graph implementation, then applied to an interesting train station problem