Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark final states in html generated by d3 #7

Open
Devorein opened this issue Nov 13, 2021 · 0 comments
Open

Mark final states in html generated by d3 #7

Devorein opened this issue Nov 13, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Devorein
Copy link
Owner

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
image
But no final states are marked at the leaf nodes.

@Devorein Devorein self-assigned this Nov 13, 2021
@Devorein Devorein added the enhancement New feature or request label Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant