Skip to content

Instantly share code, notes, and snippets.

@pocari
Created December 4, 2012 16:20
Show Gist options
  • Save pocari/4205750 to your computer and use it in GitHub Desktop.
Save pocari/4205750 to your computer and use it in GitHub Desktop.
GraphVizTest
require "graphviz"
#http://www.graphviz.org/Download_windows.php
g = GraphViz::new("G", { :type => "digraph", :use => "dot"})
depends = {
1 => [],
2 => [1],
3 => [1],
4 => [3],
5 => [3],
6 => [2],
7 => [5],
8 => [7],
9 => [7],
10 => [6, 7]
}
depends.each do |job, list|
j = g.add_nodes(job.to_s)
list.each do |d|
g.add_edges(j, g.add_nodes(d.to_s))
end
end
g.output(png: "result.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment