Ejemplo n.º 1
0
        private static MinFA DFAtoMinFA(DFA dfa)
        {
            Console.WriteLine("Построение MinFA по DFA");
            var result = MinFA.FromDFA(dfa, new TableMinimizingAlgorithm());

            result.PrintGraph("MinFA.gv");
            return(result);
        }
Ejemplo n.º 2
0
        public static MinFA FromDFA(DFA dfa, IMinimizingAlgorithm minimizingAlgorithm)
        {
            var minFA = new MinFA()
            {
                Graph  = dfa.Graph.Clone(),
                Tokens = dfa.Tokens
            };

            minimizingAlgorithm.SetDFA(dfa);
            minimizingAlgorithm.Build();

            minFA.Graph = new BidirectionalGraph <Vertex, BaseEdge <Vertex> >();
            minFA.Graph.AddVertexRange(minimizingAlgorithm.States);
            minFA.Graph.AddEdgeRange(minimizingAlgorithm.Edges);

            return(minFA);
        }