Exemple #1
0
        public void BigTests(int seed, int numberOfLabels)
        {
            var rng          = new Random(seed);
            var alphabetSize = 5;
            var n            = 100 + rng.Next(100);

            var labels = Enumerable.Range(0, n).Select(x => rng.Next(numberOfLabels)).ToList();

            var dfa = new DfaTest <int>(labels);

            for (var i = 0; i < n; ++i)
            {
                for (var j = 0; j < alphabetSize; ++j)
                {
                    var to = rng.Next(n);
                    dfa.AddTransition(i, to, (char)j);
                }
            }

            CheckMinimization(dfa);
        }
Exemple #2
0
        private static DfaTest <int> DfaFromDescription(string graphDescription)
        {
            var iter  = 0;
            var input = graphDescription.Split(null).Where(t => t.Length > 0).ToList();

            var n = int.Parse(input[iter++]);
            var m = int.Parse(input[iter++]);

            var labels = Enumerable.Range(0, n).Select(x => int.Parse(input[iter++])).ToList();

            var dfa = new DfaTest <int>(labels);

            for (var i = 0; i < m; ++i)
            {
                var from   = int.Parse(input[iter++]) - 1;
                var to     = int.Parse(input[iter++]) - 1;
                var letter = char.Parse(input[iter++]);
                dfa.AddTransition(from, to, letter);
            }

            return(dfa);
        }