Skip to content

Instantly share code, notes, and snippets.

@kellyrob99
Created April 23, 2012 01:57
Show Gist options
  • Select an option

  • Save kellyrob99/2468212 to your computer and use it in GitHub Desktop.

Select an option

Save kellyrob99/2468212 to your computer and use it in GitHub Desktop.
Given a GraphViz dot file, create combinations of layouts and output formats; depends on having the dot executable preinstalled
import groovyx.gpars.GParsPool
def inputfile = args[0]
def layouts = [ 'twopi', 'sfdp', 'osage']
def formats = [ 'pdf','svg']
def combinations = [layouts, formats].combinations()
GParsPool.withPool(4) {
combinations.eachParallel { combination ->
String layout = combination[0]
String format = combination[1]
List args = [ '/usr/local/bin/dot', "-K$layout", '-Goverlap=prism', '-Goverlap_scaling=-10', "-T$format",
'-o', "${inputfile}.${layout}.$format", inputfile ]
println args
final Process execute = args.execute()
execute.waitFor()
println execute.exitValue()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment