Number of questions for connectivity in a graph

109 Views Asked by At

Assume we are given the adjacency matrix $G$ for some $n$-node graph. $G[i,j]=1$ if there is edge between $i$ and $j$, and $G[i,j]=0$ otherwise. Prove that the minimum number of questions we need to ask in order to find if the graph is connected is $\frac{n(n-1)}{2}$, where a question is considered to check once in the matrix whether two nodes are adjacent.

1

There are 1 best solutions below

2
On

Obviously you can do it in this many questions, just by asking about all the pairs. The difficulty is showing you can't guarantee to do it in fewer questions.

Hint for that: suppose before the game starts I tell you for free that there is at most one edge from vertex $n$. Given that information, the graph will be connected if and only if there is an edge from vertex $n$ and the graph on the remaining $n-1$ vertices is connected. How many questions do we need to decide these two things?