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

    :param dict dfa: DFA to export;
    :param str name: name of the output file;
    :param str path: path where to save the DOT/SVG files (default:
                     working directory)

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

    :param dict dfa: DFA to export;
    :param str name: name of the output file;
    :param str path: path where to save the DOT/SVG files (default:
                     working directory)
    """
    g = graphviz.Digraph(format='svg')
    g.node('fake', style='invisible')
    for state in dfa['states']:
        if state == dfa['initial_state']:
            if state in dfa['accepting_states']:
                g.node(str(state), root='true',
                       shape='doublecircle')
            else:
                g.node(str(state), root='true')
        elif state in dfa['accepting_states']:
            g.node(str(state), shape='doublecircle')
        else:
            g.node(str(state))

    g.edge('fake', str(dfa['initial_state']), style='bold')
    for transition in dfa['transitions']:
        g.edge(str(transition[0]),
               str(dfa['transitions'][transition]),
               label=transition[1])

    if not os.path.exists(path):
        os.makedirs(path)

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