Google Interview Question

Graph question related to traversal