Skip to content

Mark final states in html generated by d3 #7

Description

@Devorein
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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions