python_fsa.graph

Several utility functions to convert FSAs to and from dot graph format, and render FSAs as dot graphs.

Functions

dfa_from_dot(dot)

Converts a DFA graphviz dot graph to a DFA object

nfa_from_dot(dot[, epsilon])

Converts a NFA graphviz dot graph to an NFA object

render(fsa, path[, renderer])

Writes the given FSA to an image file at the given path

to_dot(fsa)

Converts the given FSA to a graphviz dot graph

to_dot(fsa: DFA | NFA) → str

Converts the given FSA to a graphviz dot graph

nfa_from_dot(dot: str, epsilon='ε') → NFA

Converts a NFA graphviz dot graph to an NFA object

dfa_from_dot(dot: str) → DFA

Converts a DFA graphviz dot graph to a DFA object

render(fsa: DFA | NFA, path: str | PurePath, renderer: str = 'dot') → None

Writes the given FSA to an image file at the given path