Generates a DOT file and a relative SVG image in **path**
    folder of the input NFA using graphviz library.

    :param dict nfa: input NFA;
    :param str name: string with the name of the output file;
    :param str path: path where to save the DOT/SVG files (default:
                     working directory).

def nfa_to_dot(nfa: dict, name: str, path: str = './'):
    """ Generates a DOT file and a relative SVG image in **path**
    folder of the input NFA using graphviz library.

    :param dict nfa: input NFA;
    :param str name: string with the name of the output file;
    :param str path: path where to save the DOT/SVG files (default:
                     working directory).
    """
    g = graphviz.Digraph(format='svg')

    fakes = []
    for i in range(len(nfa['initial_states'])):
        fakes.append('fake' + str(i))
        g.node('fake' + str(i), style='invisible')

    for state in nfa['states']:
        if state in nfa['initial_states']:
            if state in nfa['accepting_states']:
                g.node(str(state), root='true',
                       shape='doublecircle')
            else:
                g.node(str(state), root='true')
        elif state in nfa['accepting_states']:
            g.node(str(state), shape='doublecircle')
        else:
            g.node(str(state))

    for initial_state in nfa['initial_states']:
        g.edge(fakes.pop(), str(initial_state), style='bold')
    for transition in nfa['transitions']:
        for destination in nfa['transitions'][transition]:
            g.edge(str(transition[0]), str(destination),
                   label=transition[1])

    g.render(filename=os.path.join(path, name + '.dot'))