Created
December 4, 2012 16:20
-
-
Save pocari/4205750 to your computer and use it in GitHub Desktop.
GraphVizTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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