public void Test3()
        {
            var a = new GraphNode <char>('A');
            var b = new GraphNode <char>('B');
            var e = new GraphNode <char>('E');
            var f = new GraphNode <char>('F');
            var d = new GraphNode <char>('D');

            a.Add(b);
            b.Add(e);
            e.Add(f);
            f.Add(d);
            d.Add(a);

            // another branch
            var c = new GraphNode <char>('C');
            var g = new GraphNode <char>('G');

            a.Add(c);
            c.Add(g);

            // another branch
            var x = new GraphNode <char>('X');
            var w = new GraphNode <char>('W');
            var k = new GraphNode <char>('K');

            c.Add(x);
            x.Add(w);
            w.Add(k);

            var detect   = new DetectCycleInAGraph();
            var hasCycle = detect.HasCycle(a);

            Assert.IsTrue(hasCycle);
        }
        public void Test2()
        {
            var start  = new GraphNode <int>(10);
            var twenty = new GraphNode <int>(20);
            var thirty = new GraphNode <int>(30);

            start.Add(twenty);
            twenty.Add(thirty);

            var detect   = new DetectCycleInAGraph();
            var hasCycle = detect.HasCycle(start);

            Assert.IsFalse(hasCycle);
        }