Mark final states in html generated by d3
Devorein opened this issue · comments
Safwan Shaheer commented
const { NonDeterministicFiniteAutomaton, Render } = require('fauton');
const path = require('path');
const nfa = new NonDeterministicFiniteAutomaton((_, automatonTestResult) => automatonTestResult, {
label: 'NFA 1',
final_states: ['D'],
start_state: 'A',
alphabets: ['0', '1'],
states: ['A', 'B', 'C', 'D'],
transitions: {
A: ['A'],
B: ['D', 'C'],
D: [null, 'D'],
},
epsilon_transitions: {
A: ['C'],
C: ['B'],
D: ['C'],
},
});
const { graph } = nfa.generateGraphFromString('1101');
Render.graphToHtml(graph, path.join(__dirname, 'index.html'));
For a d3 html graph generated from a nfa, no final states are marked. The above code would generate the following graph
But no final states are marked at the leaf nodes.