Generalized the dot export function

It now accepts an output format parameter which it passes to graphviz.