An algorithm to calculate if a journey is possible for a series of locations in a city, connected by roads.