def get_shortest_path(pred, orig, dest):
    """
    Get the shortest path to dest given the predecessor list pred
    from single-source shortest path algorithm

    Parameters:
       pred - list of predecessor nodes from a sssp algorithm with orig 
              as source
       source - source node
       dest  - destinatino node

    Return value:
      list of nodes on shortest path to dest from orig
    """
    path = []
    v = dest
    while v != orig:
        if v == -1:
            return None
        path.append(v)
        v = pred[v]
    path.append(orig)
    path.reverse()
    return path