ruby-graphviz 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.all-contributorsrc +309 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +30 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.gitignore +3 -0
- data/.travis.yml +6 -19
- data/.yardopts +19 -0
- data/CHANGELOG.md +265 -0
- data/{COPYING.rdoc → COPYING.md} +7 -6
- data/README.md +297 -0
- data/Rakefile +22 -23
- data/lib/graphviz.rb +10 -4
- data/lib/graphviz/constants.rb +2 -1
- data/lib/graphviz/core_ext.rb +0 -7
- data/lib/graphviz/edge.rb +1 -1
- data/ruby-graphviz.gemspec +11 -13
- metadata +61 -18
- data/AUTHORS.rdoc +0 -41
- data/CHANGELOG.rdoc +0 -307
- data/README.rdoc +0 -203
data/README.rdoc
DELETED
@@ -1,203 +0,0 @@
|
|
1
|
-
= Ruby/GraphViz
|
2
|
-
|
3
|
-
{<img src="https://secure.travis-ci.org/glejeune/Ruby-Graphviz.svg" />}[https://travis-ci.org/glejeune/Ruby-Graphviz]
|
4
|
-
{<img src="https://badge.fury.io/rb/ruby-graphviz.svg" alt="Gem Version" />}[https://rubygems.org/gems/ruby-graphviz]
|
5
|
-
|
6
|
-
Copyright (C) 2004-2018 Gregoire Lejeune
|
7
|
-
|
8
|
-
* Doc : http://rdoc.info/projects/glejeune/Ruby-Graphviz
|
9
|
-
* Sources : https://github.com/glejeune/Ruby-Graphviz
|
10
|
-
* On Rubygems: https://rubygems.org/gems/ruby-graphviz
|
11
|
-
* <b>NEW</b> - Mailing List : https://groups.google.com/forum/#!forum/ruby-graphviz
|
12
|
-
|
13
|
-
== DESCRIPTION
|
14
|
-
|
15
|
-
Interface to the GraphViz graphing tool
|
16
|
-
|
17
|
-
== TODO
|
18
|
-
|
19
|
-
* New FamilyTree
|
20
|
-
|
21
|
-
== SYNOPSIS
|
22
|
-
|
23
|
-
A basic example
|
24
|
-
|
25
|
-
require 'graphviz'
|
26
|
-
|
27
|
-
# Create a new graph
|
28
|
-
g = GraphViz.new( :G, :type => :digraph )
|
29
|
-
|
30
|
-
# Create two nodes
|
31
|
-
hello = g.add_nodes( "Hello" )
|
32
|
-
world = g.add_nodes( "World" )
|
33
|
-
|
34
|
-
# Create an edge between the two nodes
|
35
|
-
g.add_edges( hello, world )
|
36
|
-
|
37
|
-
# Generate output image
|
38
|
-
g.output( :png => "hello_world.png" )
|
39
|
-
|
40
|
-
The same but with a block
|
41
|
-
|
42
|
-
require 'graphviz'
|
43
|
-
|
44
|
-
GraphViz::new( :G, :type => :digraph ) { |g|
|
45
|
-
g.world( :label => "World" ) << g.hello( :label => "Hello" )
|
46
|
-
}.output( :png => "hello_world.png" )
|
47
|
-
|
48
|
-
Or with the DSL
|
49
|
-
|
50
|
-
require 'graphviz/dsl'
|
51
|
-
digraph :G do
|
52
|
-
world[:label => "World"] << hello[:label => "Hello"]
|
53
|
-
|
54
|
-
output :png => "hello_world.png"
|
55
|
-
end
|
56
|
-
|
57
|
-
Create a graph from a file
|
58
|
-
|
59
|
-
require 'graphviz'
|
60
|
-
|
61
|
-
# In this example, hello.dot is :
|
62
|
-
# digraph G {Hello->World;}
|
63
|
-
|
64
|
-
GraphViz.parse( "hello.dot", :path => "/usr/local/bin" ) { |g|
|
65
|
-
g.get_node("Hello") { |n|
|
66
|
-
n[:label] = "Bonjour"
|
67
|
-
}
|
68
|
-
g.get_node("World") { |n|
|
69
|
-
n[:label] = "Le Monde"
|
70
|
-
}
|
71
|
-
}.output(:png => "sample.png")
|
72
|
-
|
73
|
-
GraphML[http://graphml.graphdrawing.org/] support
|
74
|
-
|
75
|
-
require 'graphviz/graphml'
|
76
|
-
|
77
|
-
g = GraphViz::GraphML.new( "graphml/cluster.graphml" )
|
78
|
-
g.graph.output( :path => "/usr/local/bin", :png => "#{$0}.png" )
|
79
|
-
|
80
|
-
|
81
|
-
== TOOLS
|
82
|
-
|
83
|
-
Ruby/GraphViz also includes :
|
84
|
-
|
85
|
-
* <tt>ruby2gv</tt>, a simple tool that allows you to create a dependency graph from a ruby script. Example : http://drp.ly/dShaZ
|
86
|
-
|
87
|
-
ruby2gv -Tpng -oruby2gv.png ruby2gv
|
88
|
-
|
89
|
-
* <tt>gem2gv</tt>, a tool that allows you to create a dependency graph between gems. Example : http://drp.ly/dSj9Y
|
90
|
-
|
91
|
-
gem2gv -Tpng -oruby-graphviz.png ruby-graphviz
|
92
|
-
|
93
|
-
* <tt>dot2ruby</tt>, a tool that allows you to create a ruby script from a graphviz script
|
94
|
-
|
95
|
-
$ cat hello.dot
|
96
|
-
digraph G {Hello->World;}
|
97
|
-
|
98
|
-
$ dot2ruby hello.dot
|
99
|
-
# This code was generated by dot2ruby.g
|
100
|
-
|
101
|
-
require 'rubygems'
|
102
|
-
require 'graphviz'
|
103
|
-
graph_g = GraphViz.digraph( "G" ) { |graph_g|
|
104
|
-
graph_g[:bb] = '0,0,70,108'
|
105
|
-
node_hello = graph_g.add_nodes( "Hello", :height => '0.5', :label => '\N', :pos => '35,90', :width => '0.88889' )
|
106
|
-
graph_g.add_edges( "Hello", "World", :pos => 'e,35,36.413 35,71.831 35,64.131 35,54.974 35,46.417' )
|
107
|
-
node_world = graph_g.add_nodes( "World", :height => '0.5', :label => '\N', :pos => '35,18', :width => '0.97222' )
|
108
|
-
}
|
109
|
-
puts graph_g.output( :canon => String )
|
110
|
-
|
111
|
-
* <tt>git2gv</tt>, a tool that allows you to show your git commits
|
112
|
-
|
113
|
-
* <tt>xml2gv</tt>, a tool that allows you to show a xml file as graph.
|
114
|
-
|
115
|
-
== GRAPH THEORY
|
116
|
-
|
117
|
-
require 'graphviz'
|
118
|
-
require 'graphviz/theory'
|
119
|
-
|
120
|
-
g = GraphViz.new( :G ) { ... }
|
121
|
-
|
122
|
-
t = GraphViz::Theory.new( g )
|
123
|
-
|
124
|
-
puts "Adjancy matrix : "
|
125
|
-
puts t.adjancy_matrix
|
126
|
-
|
127
|
-
puts "Symmetric ? #{t.symmetric?}"
|
128
|
-
|
129
|
-
puts "Incidence matrix :"
|
130
|
-
puts t.incidence_matrix
|
131
|
-
|
132
|
-
g.each_node do |name, node|
|
133
|
-
puts "Degree of node `#{name}' = #{t.degree(node)}"
|
134
|
-
end
|
135
|
-
|
136
|
-
puts "Laplacian matrix :"
|
137
|
-
puts t.laplacian_matrix
|
138
|
-
|
139
|
-
puts "Dijkstra between a and f"
|
140
|
-
r = t.moore_dijkstra(g.a, g.f)
|
141
|
-
if r.nil?
|
142
|
-
puts "No way !"
|
143
|
-
else
|
144
|
-
print "\tPath : "; p r[:path]
|
145
|
-
puts "\tDistance : #{r[:distance]}"
|
146
|
-
end
|
147
|
-
|
148
|
-
print "Ranges : "
|
149
|
-
rr = t.range
|
150
|
-
p rr
|
151
|
-
puts "Your graph contains circuits" if rr.include?(nil)
|
152
|
-
|
153
|
-
puts "Critical path : "
|
154
|
-
rrr = t.critical_path
|
155
|
-
print "\tPath "; p rrr[:path]
|
156
|
-
puts "\tDistance : #{rrr[:distance]}"
|
157
|
-
|
158
|
-
== INSTALLATION
|
159
|
-
|
160
|
-
sudo gem install ruby-graphviz
|
161
|
-
|
162
|
-
You also need to install GraphViz[http://www.graphviz.org]
|
163
|
-
|
164
|
-
On *Windows* you also need to install win32-open3. This is not an absolute requirement.
|
165
|
-
|
166
|
-
== LICENCES
|
167
|
-
|
168
|
-
=== Ruby/GraphViz
|
169
|
-
|
170
|
-
Ruby/GraphViz is freely distributable according to the terms of the
|
171
|
-
GNU General Public License (see the file 'COPYING').
|
172
|
-
|
173
|
-
This program is distributed without any warranty. See the file
|
174
|
-
'COPYING' for details.
|
175
|
-
|
176
|
-
GNU General Public Licence: https://en.wikipedia.org/wiki/Gpl
|
177
|
-
|
178
|
-
=== nothugly.xsl
|
179
|
-
|
180
|
-
By Vidar Hokstad and Ryan Shea; Contributions by Jonas Tingborn,
|
181
|
-
Earl Cummings, Michael Kennedy (Graphviz 2.20.2 compatibility, bug fixes, testing, lots of gradients)
|
182
|
-
|
183
|
-
Copyright (c) 2009 Vidar Hokstad
|
184
|
-
|
185
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
186
|
-
of this software and associated documentation files (the "Software"), to deal
|
187
|
-
in the Software without restriction, including without limitation the rights
|
188
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
189
|
-
copies of the Software, and to permit persons to whom the Software is
|
190
|
-
furnished to do so, subject to the following conditions:
|
191
|
-
|
192
|
-
The above copyright notice and this permission notice shall be included in
|
193
|
-
all copies or substantial portions of the Software.
|
194
|
-
|
195
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
196
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
197
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
198
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
199
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
200
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
201
|
-
THE SOFTWARE.
|
202
|
-
|
203
|
-
MIT license: https://en.wikipedia.org/wiki/MIT_License
|