Can imagine train traces particularly being tricky. Might have to build a separate routing graph of just train lines and filter out any traces that match that too strongly - though I don't think people mapping train lines in OSM work too hard to get train lines' routeability right...