Trajectory inference and generation numbers