Example #1
0
        public static void TestIsCycleInUnDirectedGraph()
        {
            UndirectedGraph udg = GraphProbHelper.CreateUndirectedGraphWithoutCycle();

            Console.WriteLine("Is the cycle present in the undirected graph: {0}", IsCycleInUnDirectedGraph(udg));

            udg = GraphProbHelper.CreateUndirectedGraphWithCycle();
            Console.WriteLine("Is the cycle present in the undirected graph: {0}", IsCycleInUnDirectedGraph(udg));
        }
Example #2
0
        public static void TestIsGraphATree()
        {
            IsGraphATree gt = new IsGraphATree();

            UndirectedGraph udg = GraphProbHelper.CreateUndirectedGraphWithoutCycleWithoutUnconnectedNodes();

            Console.WriteLine("Is the cycle present in the undirected graph: {0}", gt.IsGraphTree(udg));

            udg = GraphProbHelper.CreateUndirectedGraphWithoutCycle();
            Console.WriteLine("Is the cycle present in the undirected graph: {0}", gt.IsGraphTree(udg));

            udg = GraphProbHelper.CreateUndirectedGraphWithCycle();
            Console.WriteLine("Is the cycle present in the undirected graph: {0}", gt.IsGraphTree(udg));
        }