silicium 0.0.2 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -3
  3. data/.travis.yml +14 -25
  4. data/Gemfile +0 -4
  5. data/README.md +0 -2
  6. data/Rakefile +0 -7
  7. data/lib/silicium/version.rb +1 -1
  8. data/lib/silicium.rb +1 -0
  9. data/silicium.gemspec +37 -39
  10. metadata +4 -92
  11. data/.codeclimate.yml +0 -4
  12. data/Makefile +0 -269
  13. data/docs/Object.html +0 -117
  14. data/docs/README_md.html +0 -142
  15. data/docs/Silicium/Combinatorics.html +0 -270
  16. data/docs/Silicium/Dice/Polyhedron.html +0 -315
  17. data/docs/Silicium/Dice/PolyhedronSet.html +0 -321
  18. data/docs/Silicium/Dice.html +0 -99
  19. data/docs/Silicium/Error.html +0 -106
  20. data/docs/Silicium/Geometry/Line2dCanon.html +0 -243
  21. data/docs/Silicium/Geometry/VariablesOrderException.html +0 -106
  22. data/docs/Silicium/Geometry.html +0 -940
  23. data/docs/Silicium/Graphs/GraphError.html +0 -106
  24. data/docs/Silicium/Graphs/OrientedGraph.html +0 -775
  25. data/docs/Silicium/Graphs/UnorientedGraph.html +0 -284
  26. data/docs/Silicium/Graphs.html +0 -164
  27. data/docs/Silicium/IntegralDoesntExistError.html +0 -106
  28. data/docs/Silicium/NumericalIntegration.html +0 -521
  29. data/docs/Silicium/Optimization.html +0 -639
  30. data/docs/Silicium/Plotter/Image.html +0 -297
  31. data/docs/Silicium/Plotter.html +0 -186
  32. data/docs/Silicium.html +0 -101
  33. data/docs/created.rid +0 -9
  34. data/docs/css/fonts.css +0 -167
  35. data/docs/css/rdoc.css +0 -619
  36. data/docs/fonts/Lato-Light.ttf +0 -0
  37. data/docs/fonts/Lato-LightItalic.ttf +0 -0
  38. data/docs/fonts/Lato-Regular.ttf +0 -0
  39. data/docs/fonts/Lato-RegularItalic.ttf +0 -0
  40. data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
  41. data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
  42. data/docs/images/add.png +0 -0
  43. data/docs/images/arrow_up.png +0 -0
  44. data/docs/images/brick.png +0 -0
  45. data/docs/images/brick_link.png +0 -0
  46. data/docs/images/bug.png +0 -0
  47. data/docs/images/bullet_black.png +0 -0
  48. data/docs/images/bullet_toggle_minus.png +0 -0
  49. data/docs/images/bullet_toggle_plus.png +0 -0
  50. data/docs/images/date.png +0 -0
  51. data/docs/images/delete.png +0 -0
  52. data/docs/images/find.png +0 -0
  53. data/docs/images/loadingAnimation.gif +0 -0
  54. data/docs/images/macFFBgHack.png +0 -0
  55. data/docs/images/package.png +0 -0
  56. data/docs/images/page_green.png +0 -0
  57. data/docs/images/page_white_text.png +0 -0
  58. data/docs/images/page_white_width.png +0 -0
  59. data/docs/images/plugin.png +0 -0
  60. data/docs/images/ruby.png +0 -0
  61. data/docs/images/tag_blue.png +0 -0
  62. data/docs/images/tag_green.png +0 -0
  63. data/docs/images/transparent.png +0 -0
  64. data/docs/images/wrench.png +0 -0
  65. data/docs/images/wrench_orange.png +0 -0
  66. data/docs/images/zoom.png +0 -0
  67. data/docs/index.html +0 -132
  68. data/docs/js/darkfish.js +0 -84
  69. data/docs/js/navigation.js +0 -105
  70. data/docs/js/navigation.js.gz +0 -0
  71. data/docs/js/search.js +0 -110
  72. data/docs/js/search_index.js +0 -1
  73. data/docs/js/search_index.js.gz +0 -0
  74. data/docs/js/searcher.js +0 -229
  75. data/docs/js/searcher.js.gz +0 -0
  76. data/docs/table_of_contents.html +0 -608
  77. data/lib/geometry.rb +0 -236
  78. data/lib/graph.rb +0 -164
  79. data/lib/numerical_integration.rb +0 -147
  80. data/lib/optimization.rb +0 -144
  81. data/lib/plotter.rb +0 -96
  82. data/lib/theory_of_probability.rb +0 -227
@@ -1,775 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class Silicium::Graphs::OrientedGraph - RDoc Documentation</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "../../";
11
- var index_rel_prefix = "../../";
12
- </script>
13
-
14
- <script src="../../js/navigation.js" defer></script>
15
- <script src="../../js/search.js" defer></script>
16
- <script src="../../js/search_index.js" defer></script>
17
- <script src="../../js/searcher.js" defer></script>
18
- <script src="../../js/darkfish.js" defer></script>
19
-
20
- <link href="../../css/fonts.css" rel="stylesheet">
21
- <link href="../../css/rdoc.css" rel="stylesheet">
22
-
23
-
24
-
25
-
26
- <body id="top" role="document" class="class">
27
- <nav role="navigation">
28
- <div id="project-navigation">
29
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
30
- <h2>
31
- <a href="../../index.html" rel="home">Home</a>
32
- </h2>
33
-
34
- <div id="table-of-contents-navigation">
35
- <a href="../../table_of_contents.html#pages">Pages</a>
36
- <a href="../../table_of_contents.html#classes">Classes</a>
37
- <a href="../../table_of_contents.html#methods">Methods</a>
38
- </div>
39
- </div>
40
-
41
- <div id="search-section" role="search" class="project-section initially-hidden">
42
- <form action="#" method="get" accept-charset="utf-8">
43
- <div id="search-field-wrapper">
44
- <input id="search-field" role="combobox" aria-label="Search"
45
- aria-autocomplete="list" aria-controls="search-results"
46
- type="text" name="search" placeholder="Search" spellcheck="false"
47
- title="Type to search, Up and Down to navigate, Enter to load">
48
- </div>
49
-
50
- <ul id="search-results" aria-label="Search Results"
51
- aria-busy="false" aria-expanded="false"
52
- aria-atomic="false" class="initially-hidden"></ul>
53
- </form>
54
- </div>
55
-
56
- </div>
57
-
58
-
59
-
60
- <div id="class-metadata">
61
-
62
- <div id="parent-class-section" class="nav-section">
63
- <h3>Parent</h3>
64
-
65
-
66
- <p class="link"><a href="../../Object.html">Object</a>
67
-
68
- </div>
69
-
70
-
71
-
72
- <!-- Method Quickref -->
73
- <div id="method-list-section" class="nav-section">
74
- <h3>Methods</h3>
75
-
76
- <ul class="link-list" role="directory">
77
-
78
- <li ><a href="#method-c-new">::new</a>
79
-
80
- <li ><a href="#method-i-add_edge-21">#add_edge!</a>
81
-
82
- <li ><a href="#method-i-add_edge_force-21">#add_edge_force!</a>
83
-
84
- <li ><a href="#method-i-add_vertex-21">#add_vertex!</a>
85
-
86
- <li ><a href="#method-i-adjacted_with">#adjacted_with</a>
87
-
88
- <li ><a href="#method-i-delete_edge-21">#delete_edge!</a>
89
-
90
- <li ><a href="#method-i-delete_vertex-21">#delete_vertex!</a>
91
-
92
- <li ><a href="#method-i-edge_label_number">#edge_label_number</a>
93
-
94
- <li ><a href="#method-i-edge_number">#edge_number</a>
95
-
96
- <li ><a href="#method-i-get_edge_label">#get_edge_label</a>
97
-
98
- <li ><a href="#method-i-get_vertex_label">#get_vertex_label</a>
99
-
100
- <li ><a href="#method-i-has_edge-3F">#has_edge?</a>
101
-
102
- <li ><a href="#method-i-has_vertex-3F">#has_vertex?</a>
103
-
104
- <li ><a href="#method-i-label_edge-21">#label_edge!</a>
105
-
106
- <li ><a href="#method-i-label_vertex-21">#label_vertex!</a>
107
-
108
- <li ><a href="#method-i-vertex_label_number">#vertex_label_number</a>
109
-
110
- <li ><a href="#method-i-vertex_number">#vertex_number</a>
111
-
112
- </ul>
113
- </div>
114
-
115
- </div>
116
- </nav>
117
-
118
- <main role="main" aria-labelledby="class-Silicium::Graphs::OrientedGraph">
119
- <h1 id="class-Silicium::Graphs::OrientedGraph" class="class">
120
- class Silicium::Graphs::OrientedGraph
121
- </h1>
122
-
123
- <section class="description">
124
-
125
- </section>
126
-
127
-
128
- <section id="5Buntitled-5D" class="documentation-section">
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
139
- <header>
140
- <h3>Public Class Methods</h3>
141
- </header>
142
-
143
-
144
- <div id="method-c-new" class="method-detail ">
145
-
146
- <div class="method-heading">
147
- <span class="method-name">new</span><span
148
- class="method-args">(initializer = [])</span>
149
-
150
- <span class="method-click-advice">click to toggle source</span>
151
-
152
- </div>
153
-
154
-
155
- <div class="method-description">
156
-
157
-
158
-
159
-
160
-
161
-
162
- <div class="method-source-code" id="new-source">
163
- <pre><span class="ruby-comment"># File lib/graph.rb, line 13</span>
164
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">initializer</span> = [])
165
- <span class="ruby-ivar">@vertices</span> = {}
166
- <span class="ruby-ivar">@edge_labels</span> = {}
167
- <span class="ruby-ivar">@vertex_labels</span> = {}
168
- <span class="ruby-identifier">initializer</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
169
- <span class="ruby-identifier">add_vertex!</span>(<span class="ruby-identifier">v</span>[<span class="ruby-value">:v</span>])
170
- <span class="ruby-identifier">v</span>[<span class="ruby-value">:i</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">iv</span><span class="ruby-operator">|</span> <span class="ruby-identifier">add_edge_force!</span>(<span class="ruby-identifier">v</span>[<span class="ruby-value">:v</span>], <span class="ruby-identifier">iv</span>)}
171
- <span class="ruby-keyword">end</span>
172
- <span class="ruby-keyword">end</span></pre>
173
- </div>
174
-
175
- </div>
176
-
177
-
178
-
179
-
180
- </div>
181
-
182
-
183
- </section>
184
-
185
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
186
- <header>
187
- <h3>Public Instance Methods</h3>
188
- </header>
189
-
190
-
191
- <div id="method-i-add_edge-21" class="method-detail ">
192
-
193
- <div class="method-heading">
194
- <span class="method-name">add_edge!</span><span
195
- class="method-args">(from, to)</span>
196
-
197
- <span class="method-click-advice">click to toggle source</span>
198
-
199
- </div>
200
-
201
-
202
- <div class="method-description">
203
-
204
-
205
-
206
-
207
-
208
-
209
- <div class="method-source-code" id="add_edge-21-source">
210
- <pre><span class="ruby-comment"># File lib/graph.rb, line 30</span>
211
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_edge!</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)
212
- <span class="ruby-keyword">if</span> <span class="ruby-ivar">@vertices</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">from</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@vertices</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">to</span>)
213
- <span class="ruby-ivar">@vertices</span>[<span class="ruby-identifier">from</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">to</span>
214
- <span class="ruby-keyword">end</span>
215
- <span class="ruby-keyword">end</span></pre>
216
- </div>
217
-
218
- </div>
219
-
220
-
221
-
222
-
223
- </div>
224
-
225
-
226
- <div id="method-i-add_edge_force-21" class="method-detail ">
227
-
228
- <div class="method-heading">
229
- <span class="method-name">add_edge_force!</span><span
230
- class="method-args">(from, to)</span>
231
-
232
- <span class="method-click-advice">click to toggle source</span>
233
-
234
- </div>
235
-
236
-
237
- <div class="method-description">
238
-
239
- <p>should only be used in constructor</p>
240
-
241
-
242
-
243
-
244
- <div class="method-source-code" id="add_edge_force-21-source">
245
- <pre><span class="ruby-comment"># File lib/graph.rb, line 37</span>
246
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_edge_force!</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)
247
- <span class="ruby-identifier">add_vertex!</span>(<span class="ruby-identifier">from</span>)
248
- <span class="ruby-identifier">add_vertex!</span>(<span class="ruby-identifier">to</span>)
249
- <span class="ruby-identifier">add_edge!</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)
250
- <span class="ruby-keyword">end</span></pre>
251
- </div>
252
-
253
- </div>
254
-
255
-
256
-
257
-
258
- </div>
259
-
260
-
261
- <div id="method-i-add_vertex-21" class="method-detail ">
262
-
263
- <div class="method-heading">
264
- <span class="method-name">add_vertex!</span><span
265
- class="method-args">(vertex_id)</span>
266
-
267
- <span class="method-click-advice">click to toggle source</span>
268
-
269
- </div>
270
-
271
-
272
- <div class="method-description">
273
-
274
-
275
-
276
-
277
-
278
-
279
- <div class="method-source-code" id="add_vertex-21-source">
280
- <pre><span class="ruby-comment"># File lib/graph.rb, line 23</span>
281
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_vertex!</span>(<span class="ruby-identifier">vertex_id</span>)
282
- <span class="ruby-keyword">if</span> <span class="ruby-ivar">@vertices</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">vertex_id</span>)
283
- <span class="ruby-keyword">return</span>
284
- <span class="ruby-keyword">end</span>
285
- <span class="ruby-ivar">@vertices</span>[<span class="ruby-identifier">vertex_id</span>] = [].<span class="ruby-identifier">to_set</span>
286
- <span class="ruby-keyword">end</span></pre>
287
- </div>
288
-
289
- </div>
290
-
291
-
292
-
293
-
294
- </div>
295
-
296
-
297
- <div id="method-i-adjacted_with" class="method-detail ">
298
-
299
- <div class="method-heading">
300
- <span class="method-name">adjacted_with</span><span
301
- class="method-args">(vertex)</span>
302
-
303
- <span class="method-click-advice">click to toggle source</span>
304
-
305
- </div>
306
-
307
-
308
- <div class="method-description">
309
-
310
-
311
-
312
-
313
-
314
-
315
- <div class="method-source-code" id="adjacted_with-source">
316
- <pre><span class="ruby-comment"># File lib/graph.rb, line 43</span>
317
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">adjacted_with</span>(<span class="ruby-identifier">vertex</span>)
318
- <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@vertices</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">vertex</span>)
319
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">GraphError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Graph does not contain vertex #{vertex}&quot;</span>)
320
- <span class="ruby-keyword">end</span>
321
-
322
- <span class="ruby-ivar">@vertices</span>[<span class="ruby-identifier">vertex</span>].<span class="ruby-identifier">clone</span>
323
- <span class="ruby-keyword">end</span></pre>
324
- </div>
325
-
326
- </div>
327
-
328
-
329
-
330
-
331
- </div>
332
-
333
-
334
- <div id="method-i-delete_edge-21" class="method-detail ">
335
-
336
- <div class="method-heading">
337
- <span class="method-name">delete_edge!</span><span
338
- class="method-args">(from, to)</span>
339
-
340
- <span class="method-click-advice">click to toggle source</span>
341
-
342
- </div>
343
-
344
-
345
- <div class="method-description">
346
-
347
-
348
-
349
-
350
-
351
-
352
- <div class="method-source-code" id="delete_edge-21-source">
353
- <pre><span class="ruby-comment"># File lib/graph.rb, line 125</span>
354
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_edge!</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)
355
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">has_edge?</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)
356
- <span class="ruby-ivar">@vertices</span>[<span class="ruby-identifier">from</span>].<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">to</span>)
357
- <span class="ruby-ivar">@edge_labels</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-constant">Pair</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>))
358
- <span class="ruby-keyword">end</span>
359
- <span class="ruby-keyword">end</span></pre>
360
- </div>
361
-
362
- </div>
363
-
364
-
365
-
366
-
367
- </div>
368
-
369
-
370
- <div id="method-i-delete_vertex-21" class="method-detail ">
371
-
372
- <div class="method-heading">
373
- <span class="method-name">delete_vertex!</span><span
374
- class="method-args">(vertex)</span>
375
-
376
- <span class="method-click-advice">click to toggle source</span>
377
-
378
- </div>
379
-
380
-
381
- <div class="method-description">
382
-
383
-
384
-
385
-
386
-
387
-
388
- <div class="method-source-code" id="delete_vertex-21-source">
389
- <pre><span class="ruby-comment"># File lib/graph.rb, line 111</span>
390
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_vertex!</span>(<span class="ruby-identifier">vertex</span>)
391
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">has_vertex?</span>(<span class="ruby-identifier">vertex</span>)
392
- <span class="ruby-ivar">@vertices</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
393
- <span class="ruby-identifier">delete_edge!</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">vertex</span>)
394
- <span class="ruby-keyword">end</span>
395
- <span class="ruby-ivar">@vertices</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">vertex</span>)
396
- <span class="ruby-ivar">@vertex_labels</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">vertex</span>)
397
-
398
- <span class="ruby-ivar">@vertices</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
399
- <span class="ruby-ivar">@edge_labels</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-constant">Pair</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">vertex</span>, <span class="ruby-identifier">key</span>))
400
- <span class="ruby-keyword">end</span>
401
- <span class="ruby-keyword">end</span>
402
- <span class="ruby-keyword">end</span></pre>
403
- </div>
404
-
405
- </div>
406
-
407
-
408
-
409
-
410
- </div>
411
-
412
-
413
- <div id="method-i-edge_label_number" class="method-detail ">
414
-
415
- <div class="method-heading">
416
- <span class="method-name">edge_label_number</span><span
417
- class="method-args">()</span>
418
-
419
- <span class="method-click-advice">click to toggle source</span>
420
-
421
- </div>
422
-
423
-
424
- <div class="method-description">
425
-
426
-
427
-
428
-
429
-
430
-
431
- <div class="method-source-code" id="edge_label_number-source">
432
- <pre><span class="ruby-comment"># File lib/graph.rb, line 99</span>
433
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">edge_label_number</span>
434
- <span class="ruby-ivar">@edge_labels</span>.<span class="ruby-identifier">count</span>
435
- <span class="ruby-keyword">end</span></pre>
436
- </div>
437
-
438
- </div>
439
-
440
-
441
-
442
-
443
- </div>
444
-
445
-
446
- <div id="method-i-edge_number" class="method-detail ">
447
-
448
- <div class="method-heading">
449
- <span class="method-name">edge_number</span><span
450
- class="method-args">()</span>
451
-
452
- <span class="method-click-advice">click to toggle source</span>
453
-
454
- </div>
455
-
456
-
457
- <div class="method-description">
458
-
459
-
460
-
461
-
462
-
463
-
464
- <div class="method-source-code" id="edge_number-source">
465
- <pre><span class="ruby-comment"># File lib/graph.rb, line 87</span>
466
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">edge_number</span>
467
- <span class="ruby-identifier">res</span> = <span class="ruby-value">0</span>
468
- <span class="ruby-ivar">@vertices</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
469
- <span class="ruby-identifier">res</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">count</span>
470
- <span class="ruby-keyword">end</span>
471
- <span class="ruby-identifier">res</span>
472
- <span class="ruby-keyword">end</span></pre>
473
- </div>
474
-
475
- </div>
476
-
477
-
478
-
479
-
480
- </div>
481
-
482
-
483
- <div id="method-i-get_edge_label" class="method-detail ">
484
-
485
- <div class="method-heading">
486
- <span class="method-name">get_edge_label</span><span
487
- class="method-args">(from, to)</span>
488
-
489
- <span class="method-click-advice">click to toggle source</span>
490
-
491
- </div>
492
-
493
-
494
- <div class="method-description">
495
-
496
-
497
-
498
-
499
-
500
-
501
- <div class="method-source-code" id="get_edge_label-source">
502
- <pre><span class="ruby-comment"># File lib/graph.rb, line 67</span>
503
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_edge_label</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)
504
- <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@vertices</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">from</span>) <span class="ruby-operator">||</span> <span class="ruby-operator">!</span> <span class="ruby-ivar">@vertices</span>[<span class="ruby-identifier">from</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">to</span>)
505
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">GraphError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Graph does not contain edge (#{from}, #{to})&quot;</span>)
506
- <span class="ruby-keyword">end</span>
507
-
508
- <span class="ruby-ivar">@edge_labels</span>[<span class="ruby-constant">Pair</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)]
509
- <span class="ruby-keyword">end</span></pre>
510
- </div>
511
-
512
- </div>
513
-
514
-
515
-
516
-
517
- </div>
518
-
519
-
520
- <div id="method-i-get_vertex_label" class="method-detail ">
521
-
522
- <div class="method-heading">
523
- <span class="method-name">get_vertex_label</span><span
524
- class="method-args">(vertex)</span>
525
-
526
- <span class="method-click-advice">click to toggle source</span>
527
-
528
- </div>
529
-
530
-
531
- <div class="method-description">
532
-
533
-
534
-
535
-
536
-
537
-
538
- <div class="method-source-code" id="get_vertex_label-source">
539
- <pre><span class="ruby-comment"># File lib/graph.rb, line 75</span>
540
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_vertex_label</span>(<span class="ruby-identifier">vertex</span>)
541
- <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@vertices</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">vertex</span>)
542
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">GraphError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Graph does not contain vertex #{vertex}&quot;</span>)
543
- <span class="ruby-keyword">end</span>
544
-
545
- <span class="ruby-ivar">@vertex_labels</span>[<span class="ruby-identifier">vertex</span>]
546
- <span class="ruby-keyword">end</span></pre>
547
- </div>
548
-
549
- </div>
550
-
551
-
552
-
553
-
554
- </div>
555
-
556
-
557
- <div id="method-i-has_edge-3F" class="method-detail ">
558
-
559
- <div class="method-heading">
560
- <span class="method-name">has_edge?</span><span
561
- class="method-args">(from, to)</span>
562
-
563
- <span class="method-click-advice">click to toggle source</span>
564
-
565
- </div>
566
-
567
-
568
- <div class="method-description">
569
-
570
-
571
-
572
-
573
-
574
-
575
- <div class="method-source-code" id="has_edge-3F-source">
576
- <pre><span class="ruby-comment"># File lib/graph.rb, line 107</span>
577
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">has_edge?</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)
578
- <span class="ruby-ivar">@vertices</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">from</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@vertices</span>[<span class="ruby-identifier">from</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">to</span>)
579
- <span class="ruby-keyword">end</span></pre>
580
- </div>
581
-
582
- </div>
583
-
584
-
585
-
586
-
587
- </div>
588
-
589
-
590
- <div id="method-i-has_vertex-3F" class="method-detail ">
591
-
592
- <div class="method-heading">
593
- <span class="method-name">has_vertex?</span><span
594
- class="method-args">(vertex)</span>
595
-
596
- <span class="method-click-advice">click to toggle source</span>
597
-
598
- </div>
599
-
600
-
601
- <div class="method-description">
602
-
603
-
604
-
605
-
606
-
607
-
608
- <div class="method-source-code" id="has_vertex-3F-source">
609
- <pre><span class="ruby-comment"># File lib/graph.rb, line 103</span>
610
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">has_vertex?</span>(<span class="ruby-identifier">vertex</span>)
611
- <span class="ruby-ivar">@vertices</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">vertex</span>)
612
- <span class="ruby-keyword">end</span></pre>
613
- </div>
614
-
615
- </div>
616
-
617
-
618
-
619
-
620
- </div>
621
-
622
-
623
- <div id="method-i-label_edge-21" class="method-detail ">
624
-
625
- <div class="method-heading">
626
- <span class="method-name">label_edge!</span><span
627
- class="method-args">(from, to, label)</span>
628
-
629
- <span class="method-click-advice">click to toggle source</span>
630
-
631
- </div>
632
-
633
-
634
- <div class="method-description">
635
-
636
-
637
-
638
-
639
-
640
-
641
- <div class="method-source-code" id="label_edge-21-source">
642
- <pre><span class="ruby-comment"># File lib/graph.rb, line 51</span>
643
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">label_edge!</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>, <span class="ruby-identifier">label</span>)
644
- <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@vertices</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">from</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@vertices</span>[<span class="ruby-identifier">from</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">to</span>)
645
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">GraphError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Graph does not contain edge (#{from}, #{to})&quot;</span>)
646
- <span class="ruby-keyword">end</span>
647
-
648
- <span class="ruby-ivar">@edge_labels</span>[<span class="ruby-constant">Pair</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)] = <span class="ruby-identifier">label</span>
649
- <span class="ruby-keyword">end</span></pre>
650
- </div>
651
-
652
- </div>
653
-
654
-
655
-
656
-
657
- </div>
658
-
659
-
660
- <div id="method-i-label_vertex-21" class="method-detail ">
661
-
662
- <div class="method-heading">
663
- <span class="method-name">label_vertex!</span><span
664
- class="method-args">(vertex, label)</span>
665
-
666
- <span class="method-click-advice">click to toggle source</span>
667
-
668
- </div>
669
-
670
-
671
- <div class="method-description">
672
-
673
-
674
-
675
-
676
-
677
-
678
- <div class="method-source-code" id="label_vertex-21-source">
679
- <pre><span class="ruby-comment"># File lib/graph.rb, line 59</span>
680
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">label_vertex!</span>(<span class="ruby-identifier">vertex</span>, <span class="ruby-identifier">label</span>)
681
- <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@vertices</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">vertex</span>)
682
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">GraphError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Graph does not contain vertex #{vertex}&quot;</span>)
683
- <span class="ruby-keyword">end</span>
684
-
685
- <span class="ruby-ivar">@vertex_labels</span>[<span class="ruby-identifier">vertex</span>] = <span class="ruby-identifier">label</span>
686
- <span class="ruby-keyword">end</span></pre>
687
- </div>
688
-
689
- </div>
690
-
691
-
692
-
693
-
694
- </div>
695
-
696
-
697
- <div id="method-i-vertex_label_number" class="method-detail ">
698
-
699
- <div class="method-heading">
700
- <span class="method-name">vertex_label_number</span><span
701
- class="method-args">()</span>
702
-
703
- <span class="method-click-advice">click to toggle source</span>
704
-
705
- </div>
706
-
707
-
708
- <div class="method-description">
709
-
710
-
711
-
712
-
713
-
714
-
715
- <div class="method-source-code" id="vertex_label_number-source">
716
- <pre><span class="ruby-comment"># File lib/graph.rb, line 95</span>
717
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">vertex_label_number</span>
718
- <span class="ruby-ivar">@vertex_labels</span>.<span class="ruby-identifier">count</span>
719
- <span class="ruby-keyword">end</span></pre>
720
- </div>
721
-
722
- </div>
723
-
724
-
725
-
726
-
727
- </div>
728
-
729
-
730
- <div id="method-i-vertex_number" class="method-detail ">
731
-
732
- <div class="method-heading">
733
- <span class="method-name">vertex_number</span><span
734
- class="method-args">()</span>
735
-
736
- <span class="method-click-advice">click to toggle source</span>
737
-
738
- </div>
739
-
740
-
741
- <div class="method-description">
742
-
743
-
744
-
745
-
746
-
747
-
748
- <div class="method-source-code" id="vertex_number-source">
749
- <pre><span class="ruby-comment"># File lib/graph.rb, line 83</span>
750
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">vertex_number</span>
751
- <span class="ruby-ivar">@vertices</span>.<span class="ruby-identifier">count</span>
752
- <span class="ruby-keyword">end</span></pre>
753
- </div>
754
-
755
- </div>
756
-
757
-
758
-
759
-
760
- </div>
761
-
762
-
763
- </section>
764
-
765
- </section>
766
-
767
- </main>
768
-
769
-
770
- <footer id="validator-badges" role="contentinfo">
771
- <p><a href="https://validator.w3.org/check/referer">Validate</a>
772
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.0.
773
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
774
- </footer>
775
-