toDot

fun <T> toDot(fst: FST<T>, out: Writer, sameRank: Boolean, labelStates: Boolean)

Dumps an FST to a GraphViz's dot language description for visualization. Example of use:

PrintWriter pw = new PrintWriter("out.dot");
Util.toDot(fst, pw, true, true);
pw.close();
*

and then, from command line:

dot -Tpng -o out.png out.dot
*

Note: larger FSTs (a few thousand nodes) won't even render, don't bother.

Parameters

sameRank

If true, the resulting dot file will try to order states in layers of breadth-first traversal. This may mess up arcs, but makes the output FST's structure a bit clearer.

labelStates

If true states will have labels equal to their offsets in their binary format. Expands the graph considerably.

See also