Esempio n. 1
0
        public void Cylces_TwoVerticesInCycle_OneWithTwo()
        {
            var graphDict = new Dictionary<string, IEnumerable<string>>();
            graphDict.Add("a", new List<string> { "b" });
            graphDict.Add("b", new List<string> { "a" });

            var cycles = graphDict.GetCycles();
            Assert.IsTrue(cycles.OfVertex("a").ContainsAllVertices("a", "b"));
            Assert.IsTrue(cycles.OfVertex("b").ContainsAllVertices("a", "b"));
        }
Esempio n. 2
0
        public void Cylces_StraightGraph_None()
        {
            var graphDict = new Dictionary<string, IEnumerable<string>>();
            graphDict.Add("a", new List<string> { "b", "c" });
            graphDict.Add("b", new List<string> { "c" });
            graphDict.Add("c", new List<string> { });

            var cycles = graphDict.GetCycles();
            Assert.AreEqual(0, cycles.Count(c => c.VertexCount > 1));
        }
Esempio n. 3
0
        public void Cylces_TwoVerticesInCycle_OneWithTwo()
        {
            var graphDict = new Dictionary <string, IEnumerable <string> >();

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

            var cycles = graphDict.GetCycles();

            Assert.IsTrue(cycles.OfVertex("a").ContainsAllVertices("a", "b"));
            Assert.IsTrue(cycles.OfVertex("b").ContainsAllVertices("a", "b"));
        }
Esempio n. 4
0
        public void Cylces_StraightGraph_None()
        {
            var graphDict = new Dictionary <string, IEnumerable <string> >();

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

            var cycles = graphDict.GetCycles();

            Assert.AreEqual(0, cycles.Count(c => c.VertexCount > 1));
        }