Advanced Algorithms: Lab Problems Set 2: Random Walks
Advanced Algorithms: Lab Problems Set 2: Random Walks
Pre requisite : You may use a graph library or write your own code for performing tasks such
as reading a graph, finding connected components etc.
Random walks
Random walks are a useful technique for analysis as well as producing practically feasible solu-
tions on large graphs. Usually the answers are not exact but either hold with high probability
or are within a bound of the exact answer.
4. Connectivity between two vertices
Depth First Search and Breadth First Search are two approaches commonly used for identifying
connected components in a graph. For large graphs it is infeasible to run a connected component
algorithm on the whole graph. Consider an undirected graph. To find out if two vertices u and
v are connected, start from one of the vertices (say u) and perform a random walk. i.e.
Initially start from vertex u. At each step, from current vertex randomly select one of the
neighbouring vertices and visit it. If this is the vertex v, report that u and v are connected and
stop. Otherwise, set the newly visited vertex as current vertex and continue. Terminate the
procedure after 2n3 steps.
Question Is the above a Las Vegas or Monte Carlo algorithm?