Example #1
0
        public void PathBetweenABExistTest()
        {
            AdjGraph <int> graph = new AdjGraph <int>(1);

            graph.AppendNodes(1, 2);
            graph.AppendNodes(2, 3);
            graph.AppendNodes(3, 4);
            graph.AppendNodes(4, 2);
            graph.AppendNodes(4, 6);
            graph.AppendNodes(6, 1);

            bool result = graph.PathBetweenABExist(1, 5);

            if (result == true)
            {
                Assert.Fail();
            }

            result = graph.PathBetweenABExist(1, 2, Guid.NewGuid());

            if (result == false)
            {
                Assert.Fail();
            }
        }
Example #2
0
        public void BreadthFirstTraversalTest()
        {
            AdjGraph <string> graph = new AdjGraph <string>("VP and Ellesemere");

            graph.AppendNodes("VP and Ellesemere", "VP and Eglington");
            graph.AppendNodes("VP and Ellesemere", "Markham and Ellesemere");
            graph.AppendNodes("Markham and Ellesemere", "Markam and Eglinton");
            graph.AppendNodes("VP and Eglington", "Markam and Eglinton");
            graph.AppendNodes("VP and Eglington", "VP and Kingston Rd");
            graph.AppendNodes("VP and Kingston Rd", "Kingston Rd and Eglinton");
            graph.AppendNodes("Kingston Rd and Eglinton", "Markam and Eglinton");

            List <string> list = graph.BreadthFirstTraversal();

            Assert.Fail();
        }