No test case for unconnected graph


The ‘expected output’ shows that unconnected graph isn’t handled properly.

Either test cases and reference solution should be fixed, or the problem should state that only connected graphs are considered.


you didn’t understand the argument of function then which is
" cloneGraph ( UndirectedGraphNode *node ) "

argument is " UndirectedGraphNode *node "
which is just a pointer to UndirectedGraphNode NODE.
if they want to give unconnected test cases then they would have given it as a
LIST of " UndirectedGraphNode * ".
so our new function would look like
UndirectedGraphNode * cloneGraph( vector<UndirectedGraphNode *> vertices)


You are a good repy.