rgl 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47e8e8f4af2accfae6599fa5d4a4a47738383132e1a4466fe08f03da6de685a5
4
- data.tar.gz: a5f2d79f45f1ebf4dba49e1249d4ab56688d802b54eefb2b656d0190af9ab5d7
3
+ metadata.gz: f9bf4828a7eabb50036be9ed0240075773066d2db007f76bc1c12db4d6ed6d58
4
+ data.tar.gz: d81980c27f49848a53fdfbfaee5d754a026a022bdef18d5cb866da795d3ab6a9
5
5
  SHA512:
6
- metadata.gz: 051d980a5da8369366f7aa2dcd261a28dbcc4068fa9356c3b96ec5a89ea377752a545b6a413316ffbecb0f3b851372c966bf3acbb5b615808dd818160053920a
7
- data.tar.gz: 4fdb3d0aa88108a1fdea83cdb65ce92ea69bd6318874d5fbced1ccd64ca8ee9651c8e948fbe302725bfef00b214da2a20849aa1d5cdcff71c4d9d07adeea8104
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
+ ![colored diagram](images/styled_graph.png "Colored DOT graph")
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 and Kirill Lashuk for contributing additions, test
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.