We can represent this an unweighted undirected graph connected with ‘$n$’ vertices and '$m$' edges into an adjacency list representation.
we can make an array of pointers of n vertices and then take a respective edge between two vertices.
We can find two vertices '$x$' and '$y$' vertices in just $O$$\left ( n \right )$ time.
And then Breadth first search is an algorithm which is used to find the shortest path in an unweighted undirected graph of '$n$' vertices and '$m$' edges, its complexity will be $O$$\left ( n+m \right )$
so overall complexity of this task would be : $O$$\left ( n+m \right )$
option $D$