static void Main(string[] args) { Graph graph = new Graph(3, 3); graph.Edges[0].Source = 0; graph.Edges[0].Destination = 1; graph.Edges[1].Source = 1; graph.Edges[1].Destination = 2; graph.Edges[2].Source = 0; graph.Edges[2].Destination = 2; for (int i = 0; i < graph.GraphVertices; i++) { graph.DisJointSets[i].Parent = i; graph.DisJointSets[i].Rank = 0; } bool cycleExists = graph.DetectCycle(graph); Console.WriteLine(cycleExists); Console.ReadLine(); }