Last Updated: 17 Mar, 2018

Detect Cycle in a Undirected Graph

Hard
Asked in company
Adobe

Problem statement

Given an undirected graph, check whether the graph contains a cycle or not. Your function should return true if the given graph contains at least one cycle, else return false.

Input format :
Line 1 : Graph of type graph class
Output Format :
return true or false