Exemple #1
0
        public void Reach_CircleGraph_All()
        {
            var graphDict = new Dictionary<string, IEnumerable<string>>();
            graphDict.Add("a", new List<string> { "b", "c" });
            graphDict.Add("b", new List<string> { "d" });
            graphDict.Add("c", new List<string> { "d" });
            graphDict.Add("d", new List<string> { "a" });

            var reach = graphDict.GetReach("a");
            Assert.IsTrue(reach.ContainsAllVertices("a", "b", "c", "d"));
        }
Exemple #2
0
        public void Reach_LineGraphFromSecondLast_LastTwoVerticesReached()
        {
            var graphDict = new Dictionary<string, IEnumerable<string>>();
            graphDict.Add("a", new List<string> { "b" });
            graphDict.Add("b", new List<string> { "c" });
            graphDict.Add("c", new List<string> { "d" });
            graphDict.Add("d", new List<string> { });

            var reach = graphDict.GetReach("c");
            Assert.IsTrue(reach.ContainsAllVerticesNot("a", "b"));
            Assert.IsTrue(reach.ContainsAllVertices("c", "d"));
        }
Exemple #3
0
        public void Reach_LineGraphFromSecondLast_LastTwoVerticesReached()
        {
            var graphDict = new Dictionary <string, IEnumerable <string> >();

            graphDict.Add("a", new List <string> {
                "b"
            });
            graphDict.Add("b", new List <string> {
                "c"
            });
            graphDict.Add("c", new List <string> {
                "d"
            });
            graphDict.Add("d", new List <string> {
            });

            var reach = graphDict.GetReach("c");

            Assert.IsTrue(reach.ContainsAllVerticesNot("a", "b"));
            Assert.IsTrue(reach.ContainsAllVertices("c", "d"));
        }
Exemple #4
0
        public void Reach_CircleGraph_All()
        {
            var graphDict = new Dictionary <string, IEnumerable <string> >();

            graphDict.Add("a", new List <string> {
                "b", "c"
            });
            graphDict.Add("b", new List <string> {
                "d"
            });
            graphDict.Add("c", new List <string> {
                "d"
            });
            graphDict.Add("d", new List <string> {
                "a"
            });

            var reach = graphDict.GetReach("a");

            Assert.IsTrue(reach.ContainsAllVertices("a", "b", "c", "d"));
        }