fauton icon indicating copy to clipboard operation
fauton copied to clipboard

Check that for dfa all states must be present in transition map

Open Devorein opened this issue 4 years ago • 0 comments

const { DeterministicFiniteAutomaton } = require('fauton');

const startsWithBC = new DeterministicFiniteAutomaton(
	(inputString) => inputString.startsWith('bc'),
	{
		alphabets: ['a', 'b'],
		states: ['A', 'B', 'C'],
		transitions: {
			A: ['B', 'A'],
			B: ['A', 'B'],
		},
	}
);

Transition for state 'C' is not present, but no error is thrown. Ideally, the user should provide all the states in the transition map, but if not an error should be generated as that's the condition of a dfa.

Devorein avatar Nov 13 '21 06:11 Devorein