public void TwoNodes()
        {
            var a = new StringTarjanNode("A");
            var b = new StringTarjanNode("B");
            a.Neighbors.Add(b);

            var underTest = new Tarjan(a, b);

            Assert.That(underTest.ResultSets.Count, Is.EqualTo(2));
        }
        public void SimpleCycle()
        {
            var a = new StringTarjanNode("A");
            var b = new StringTarjanNode("B", a);
            a.Neighbors.Add(b);

            var underTest = new Tarjan(a, b);

            Assert.That(underTest.ResultSets.Count, Is.EqualTo(1));
            Assert.That(underTest.ResultSets.First().Contains(a));
            Assert.That(underTest.ResultSets.First().Contains(b));
        }
        public void FourNodes()
        {
            var a = new StringTarjanNode("A");
            var b = new StringTarjanNode("B");
            var c = new StringTarjanNode("C");
            var d = new StringTarjanNode("D");
            a.Neighbors.Add(b);
            b.Neighbors.Add(c);
            c.Neighbors.Add(d);

            var underTest = new Tarjan(a, b, c, d);

            Assert.That(underTest.ResultSets.Count, Is.EqualTo(4));
        }
        public void LargerSimpleCycleWithBlindEnd()
        {
            var a = new StringTarjanNode("A");
            var b = new StringTarjanNode("B", a);
            var c = new StringTarjanNode("C", b);
            var d = new StringTarjanNode("D", c);
            a.Neighbors.Add(d);

            var e = new StringTarjanNode("E");
            c.Neighbors.Add(e);

            var underTest = new Tarjan(a, b, c, d, e);

            Assert.That(underTest.ResultSets.Count, Is.EqualTo(2));
            var first = underTest.ResultSets.First();
            var last = underTest.ResultSets.Last();
            var large = first.Count > last.Count ? first : last;
            var small = first.Count > last.Count ? last : first;
            Assert.That(large.Count == 4);
            Assert.That(small.Count == 1);
            Assert.That(large.Contains(a));
            Assert.That(large.Contains(b));
            Assert.That(large.Contains(c));
            Assert.That(large.Contains(d));
            Assert.That(small.Contains(e));
        }