Befor make search shortest path.