in the question where is it written that the graph will be a tree?
HOLI-Spoj graph question
@sktg99
This statement in the problem - “These N cities have N-1 highways connecting them” indicates that the given graph is a tree. This is because that any graph N nodes and N-1 edges is a graph such that all its nodes are connected. Since it possible to visit all cities and there are exactly N-1 highways , this ensures that the given graph is tree.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.