Question: Consider the following algorithm to check connectivity of a graph de ned byits adjacency matrix.ALGORITHM Connected ( A [ 0 . . n 1 ,
Consider the following algorithm to check connectivity of a graph dened byits adjacency matrix.ALGORITHM ConnectedAn n Input: Adjacency matrix An n of an undirected graph GOutput: true if G is connected and false if it is notif n return onevertex graph is connected by denitionelseif not ConnectedAn n return else for j to n doif An j return return Does this algorithm work correctly for every undirected graph with nvertices? If you answer yes, indicate the algorithms efciency class in theworst case; if you answer no explain why
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
