def dot_nfa(N, visible_eps=False): """In : N (NFA : consistent) Out: dot representation (string) Generate a dot string representing the NFA. """ assert (is_consistent_nfa(N)) N = shrink_nfastates(N) hdr = prDotHeader() # Same header would do nodeDefs = prNFANodeDefs(N) orientation = prOrientation() edges = prNFAEdges(N, visible_eps) closing = prClosing() return hdr + nodeDefs + orientation + edges + closing
def dotObj_gnfa(G, FuseEdges=False, visible_eps=False, gnfaName='GO_'): """In : G (GNFA : consistent) gnfaName (string) Out: A dot object. Generate a dot object representing the automaton. """ assert (is_consistent_gnfa(G)) # main diff wrt nfa G = shrink_nfastates(G) if gnfaName == 'GO_': gnfaName = gnfaName + NxtStateStr() dotObj1 = Digraph(comment=gnfaName) dotObj1.graph_attr['rankdir'] = 'LR' dotObj2 = addNFANodeDefs(G, dotObj1) dotObj3 = addNFAEdges(G, dotObj2, FuseEdges, visible_eps) return dotObj3
def dotObj_nfa(N, FuseEdges=False, visible_eps=False, nfaName='NO_'): """In : N (NFA : consistent) nfaName (string) Out: A dot object. Generate a dot object representing the automaton. """ assert (is_consistent_nfa(N)) N = shrink_nfastates(N) if nfaName == 'NO_': nfaName = nfaName + NxtStateStr() dotObj1 = Digraph(comment=nfaName) dotObj1.graph_attr['rankdir'] = 'LR' dotObj2 = addNFANodeDefs(N, dotObj1) dotObj3 = addNFAEdges(N, dotObj2, FuseEdges, visible_eps) return dotObj3