export function restorePathFromMap ( { end , start , parent , } ) { const path = [ end ] ; let goal = parent . get ( end ) ; while ( goal !== undefined && goal !== start ) { path . unshift ( goal ) ; goal = parent . get ( goal ) ; } return path ; }