rgl 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +37 -2
- data/examples/graph.dot +18 -934
- data/lib/rgl/base.rb +1 -1
- data/lib/rgl/dot.rb +46 -14
- data/lib/rgl/rdot.rb +185 -134
- data/test/dot_test.rb +23 -29
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9bf4828a7eabb50036be9ed0240075773066d2db007f76bc1c12db4d6ed6d58
|
4
|
+
data.tar.gz: d81980c27f49848a53fdfbfaee5d754a026a022bdef18d5cb866da795d3ab6a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dbd077be1193337f9595ed617ba68755c9cedb139edc3d56c7f5a9b1038d4473ae7e8bad522234688241db3f29fd6ddb3e580960312331f45e48e9d72bf9256
|
7
|
+
data.tar.gz: 248fa85fb1329fb561967e692f720b4e62c2f0ed6eda88658f5ec3a2e489fa12704050e209dec2ca78edd9ba3343c0dbfc2a83b41f380e1cde61e994ee63307d
|
data/README.md
CHANGED
@@ -227,6 +227,41 @@ This graph shows all loaded RGL modules:
|
|
227
227
|
Look for more in
|
228
228
|
[examples](https://github.com/monora/rgl/tree/master/examples) directory.
|
229
229
|
|
230
|
+
## (Optional) Configuring Graphviz DOT output options
|
231
|
+
|
232
|
+
The default graph will use standard DOT output visuals.
|
233
|
+
|
234
|
+
If you wish to configure the styling of the diagram, module {RGL::DOT} adds the methods {RGL::Graph#set_edge_options} and {RGL::Graph#set_vertex_options} for this purpose. You can use any options from the {RGL::DOT::NODE_OPTS} and {RGL::DOT::EDGE_OPTS} constants in {RGL::DOT}. Use the exact option name as an argument in your method call.
|
235
|
+
|
236
|
+
You can also configure the overall appearance of the graph by passing a hash of options from {RGL::DOT::GRAPH_OPTS} to the output method. The example below shows styling of vertices, edges and setting some basic graph options.
|
237
|
+
|
238
|
+
The available options are described in the [GraphViz DOT Spec](https://www.graphviz.org/pdf/dotguide.pdf)
|
239
|
+
|
240
|
+

|
241
|
+
|
242
|
+
```ruby
|
243
|
+
require 'rgl/adjacency'
|
244
|
+
require 'rgl/dot'
|
245
|
+
|
246
|
+
graph = RGL::DirectedAdjacencyGraph['a','b', 'c','d', 'a','c']
|
247
|
+
|
248
|
+
graph.set_vertex_options('a', label: 'This is A', shape: 'box3d', fontcolor: 'green', fontsize: 16)
|
249
|
+
graph.set_vertex_options('b', label: 'This is B', shape: 'tab', fontcolor: 'red', fontsize: 14)
|
250
|
+
graph.set_vertex_options('c', shape: 'tab', fontcolor: 'blue')
|
251
|
+
|
252
|
+
graph.set_edge_options('a', 'b', label: 'NotCapitalEdge', style: 'dotted', dir: 'back', color: 'magenta')
|
253
|
+
graph.set_edge_options('a', 'c', weight: 5, color: 'blue')
|
254
|
+
|
255
|
+
graph_options = {
|
256
|
+
"rankdir" => "LR",
|
257
|
+
"labelloc" => "t",
|
258
|
+
"label" => "Graph\n (generated #{Time.now.utc})"
|
259
|
+
}
|
260
|
+
|
261
|
+
graph.write_to_graphic_file('png', 'graph', graph_options)
|
262
|
+
|
263
|
+
```
|
264
|
+
|
230
265
|
## Credits
|
231
266
|
|
232
267
|
Many thanks to Robert Feldt which also worked on a graph library
|
@@ -249,14 +284,14 @@ the module {RGL::DOT} which is used instead of Roberts module to visualize
|
|
249
284
|
graphs.
|
250
285
|
|
251
286
|
Jeremy Bopp, John Carter, Sascha Doerdelmann, Shawn Garbett, Andreas
|
252
|
-
Schörk, Dan Čermák
|
287
|
+
Schörk, Dan Čermák, Kirill Lashuk and Markus Napp for contributing additions, test
|
253
288
|
cases and bugfixes.
|
254
289
|
|
255
290
|
See also: https://github.com/monora/rgl/contributors
|
256
291
|
|
257
292
|
## Copying
|
258
293
|
|
259
|
-
RGL is Copyright (c) 2002,2004,2005,2008,2013,2015,2019,2020,2022 by Horst
|
294
|
+
RGL is Copyright (c) 2002,2004,2005,2008,2013,2015,2019,2020,2022,2023 by Horst
|
260
295
|
Duchene. It is free software, and may be redistributed under the [Ruby
|
261
296
|
license](https://en.wikipedia.org/wiki/Ruby_License) and terms specified in
|
262
297
|
the LICENSE file.
|