Given a sparse undirected graph $G=(V,E)$ where $|E|=O(|V|)$, a one-hop path between a pair of vertices $(u,v)$ is a path in $G$ connecting $(u,v)$ where there is exactly one intermediate vertex between the vertices i.e. $u \leftrightarrow t \leftrightarrow v$ where $t$ is the intermediate vertex, $(u,t,v)$ are distinct vertices.
(actually I am not entire sure if 'one-hop' is the right terminology here. Let's assume it is).
I have $Q$ queries, where each query consists of a pair of vertices $(u,v)$ in $G$ and asks the question: how many distinct one-hop paths exist between the given pair of vertices. For this question let's assume $Q=O(|V|)$. All $Q$ queries are provided up-front and you do not have to answer the queries in the order given.
While I can solve this problem by counting the paths one by one for each query using an adjacency list, time complexity is $O(|V|^2)$. Is there a more efficient way to solve this?
PS: not a home work problem. Just something I have in mind.