Bidirectional BFSSearch from both endpoints, expand complete layers, and detect a shortest-path connection correctly.