def construct_path(vertex, reverse_paths):
    """Returns the shortest path to a vertex using the reverse_path mapping."""
    path = []
    while vertex is not None:
        path.append(vertex)
        vertex = reverse_paths[vertex]
    return list(reversed(path))