ds 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. data/.gitignore +2 -0
  2. data/README.rdoc +490 -0
  3. data/Rakefile +1 -1
  4. data/lib/ds.rb +17 -19
  5. data/lib/ds/ext/array_x.rb +35 -0
  6. data/lib/ds/graphs/graph.rb +36 -32
  7. data/lib/ds/graphs/graph_as_matrix.rb +22 -23
  8. data/lib/ds/graphs/graph_as_tri_matrix.rb +1 -2
  9. data/lib/ds/lists/list.rb +18 -21
  10. data/lib/ds/matrixes/array_2d.rb +4 -0
  11. data/lib/ds/pair.rb +14 -0
  12. data/lib/ds/queues/priority_queue.rb +36 -0
  13. data/lib/ds/queues/queue.rb +1 -1
  14. data/lib/ds/sets/ordered_set.rb +32 -0
  15. data/lib/ds/trees/binary_heap.rb +45 -14
  16. data/lib/ds/trees/binary_search_tree.rb +3 -1
  17. data/lib/ds/trees/binary_tree.rb +11 -5
  18. data/lib/ds/trees/complete_binary_tree.rb +24 -16
  19. data/lib/ds/trees/tree.rb +3 -3
  20. data/lib/ds/trees/tree_walker.rb +7 -6
  21. data/lib/ds/trees/trie.rb +14 -20
  22. data/lib/ds/version.rb +1 -1
  23. data/test/help.rb +12 -3
  24. data/test/test_array2d.rb +14 -4
  25. data/test/test_array_x.rb +27 -7
  26. data/test/test_binary_heap.rb +19 -1
  27. data/test/test_binary_search_tree.rb +8 -1
  28. data/test/test_binary_tree.rb +7 -1
  29. data/test/test_complete_binary_tree.rb +34 -6
  30. data/test/test_digraph.rb +1 -1
  31. data/test/test_graph.rb +10 -1
  32. data/test/test_list.rb +59 -2
  33. data/test/test_ordered_set.rb +28 -0
  34. data/test/test_pair.rb +26 -0
  35. data/test/test_priority_queue.rb +134 -0
  36. data/test/test_queue.rb +3 -3
  37. data/test/test_stack.rb +0 -2
  38. data/test/test_tree.rb +32 -9
  39. data/test/test_tree_walker.rb +22 -0
  40. data/test/test_trie.rb +20 -2
  41. metadata +13 -81
  42. data/doc/Array.html +0 -264
  43. data/doc/DS.html +0 -292
  44. data/doc/DS/Array2D.html +0 -345
  45. data/doc/DS/BinaryHeap.html +0 -493
  46. data/doc/DS/BinarySearchTree.html +0 -313
  47. data/doc/DS/BinaryTree.html +0 -433
  48. data/doc/DS/CompleteBinaryTree.html +0 -550
  49. data/doc/DS/CyclicList.html +0 -234
  50. data/doc/DS/Digraph.html +0 -299
  51. data/doc/DS/Edge.html +0 -283
  52. data/doc/DS/ExpandableArray.html +0 -316
  53. data/doc/DS/Graph.html +0 -739
  54. data/doc/DS/GraphAsList.html +0 -361
  55. data/doc/DS/GraphAsMatrix.html +0 -633
  56. data/doc/DS/GraphAsTriMatrix.html +0 -274
  57. data/doc/DS/List.html +0 -1263
  58. data/doc/DS/ListElement.html +0 -344
  59. data/doc/DS/Queue.html +0 -517
  60. data/doc/DS/Ring.html +0 -323
  61. data/doc/DS/Stack.html +0 -407
  62. data/doc/DS/Tree.html +0 -770
  63. data/doc/DS/TreeWalker.html +0 -561
  64. data/doc/DS/TriMatrix.html +0 -338
  65. data/doc/created.rid +0 -25
  66. data/doc/ds/graphs/digraph_rb.html +0 -52
  67. data/doc/ds/graphs/edge_rb.html +0 -52
  68. data/doc/ds/graphs/graph_as_list_rb.html +0 -52
  69. data/doc/ds/graphs/graph_as_matrix_rb.html +0 -52
  70. data/doc/ds/graphs/graph_as_tri_matrix_rb.html +0 -52
  71. data/doc/ds/graphs/graph_rb.html +0 -52
  72. data/doc/ds/lists/cyclic_list_rb.html +0 -52
  73. data/doc/ds/lists/list_element_rb.html +0 -52
  74. data/doc/ds/lists/list_rb.html +0 -52
  75. data/doc/ds/lists/ring_rb.html +0 -52
  76. data/doc/ds/matrixes/array_2d_rb.html +0 -52
  77. data/doc/ds/matrixes/expandable_array_rb.html +0 -52
  78. data/doc/ds/matrixes/tri_matrix_rb.html +0 -52
  79. data/doc/ds/queues/queue_rb.html +0 -52
  80. data/doc/ds/stacks/stack_rb.html +0 -52
  81. data/doc/ds/trees/binary_heap_rb.html +0 -52
  82. data/doc/ds/trees/binary_search_tree_rb.html +0 -52
  83. data/doc/ds/trees/binary_tree_rb.html +0 -52
  84. data/doc/ds/trees/complete_binary_tree_rb.html +0 -52
  85. data/doc/ds/trees/tree_rb.html +0 -52
  86. data/doc/ds/trees/tree_walker_rb.html +0 -52
  87. data/doc/ds/version_rb.html +0 -52
  88. data/doc/ds_rb.html +0 -98
  89. data/doc/ext/ext_rb.html +0 -52
  90. data/doc/images/brick.png +0 -0
  91. data/doc/images/brick_link.png +0 -0
  92. data/doc/images/bug.png +0 -0
  93. data/doc/images/bullet_black.png +0 -0
  94. data/doc/images/bullet_toggle_minus.png +0 -0
  95. data/doc/images/bullet_toggle_plus.png +0 -0
  96. data/doc/images/date.png +0 -0
  97. data/doc/images/find.png +0 -0
  98. data/doc/images/loadingAnimation.gif +0 -0
  99. data/doc/images/macFFBgHack.png +0 -0
  100. data/doc/images/package.png +0 -0
  101. data/doc/images/page_green.png +0 -0
  102. data/doc/images/page_white_text.png +0 -0
  103. data/doc/images/page_white_width.png +0 -0
  104. data/doc/images/plugin.png +0 -0
  105. data/doc/images/ruby.png +0 -0
  106. data/doc/images/tag_green.png +0 -0
  107. data/doc/images/wrench.png +0 -0
  108. data/doc/images/wrench_orange.png +0 -0
  109. data/doc/images/zoom.png +0 -0
  110. data/doc/index.html +0 -375
  111. data/doc/js/darkfish.js +0 -116
  112. data/doc/js/jquery.js +0 -32
  113. data/doc/js/quicksearch.js +0 -114
  114. data/doc/js/thickbox-compressed.js +0 -10
  115. data/doc/rdoc.css +0 -763
  116. data/lib/ds/ext/ext.rb +0 -36
  117. data/lib/ds/graphs/graph_as_list.rb +0 -48
@@ -1,739 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
7
-
8
- <title>Class: DS::Graph</title>
9
-
10
- <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
-
12
- <script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
- <script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
- <script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
- <script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
16
-
17
- </head>
18
- <body id="top" class="class">
19
-
20
- <div id="metadata">
21
- <div id="home-metadata">
22
- <div id="home-section" class="section">
23
- <h3 class="section-header">
24
- <a href="../index.html">Home</a>
25
- <a href="../index.html#classes">Classes</a>
26
- <a href="../index.html#methods">Methods</a>
27
- </h3>
28
- </div>
29
- </div>
30
-
31
- <div id="file-metadata">
32
- <div id="file-list-section" class="section">
33
- <h3 class="section-header">In Files</h3>
34
- <div class="section-body">
35
- <ul>
36
-
37
- <li><a href="../ds/graphs/graph_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
- class="thickbox" title="ds/graphs/graph.rb">ds/graphs/graph.rb</a></li>
39
-
40
- </ul>
41
- </div>
42
- </div>
43
-
44
-
45
- </div>
46
-
47
- <div id="class-metadata">
48
-
49
- <!-- Parent Class -->
50
- <div id="parent-class-section" class="section">
51
- <h3 class="section-header">Parent</h3>
52
-
53
- <p class="link">Object</p>
54
-
55
- </div>
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
- <!-- Method Quickref -->
64
- <div id="method-list-section" class="section">
65
- <h3 class="section-header">Methods</h3>
66
- <ul class="link-list">
67
-
68
- <li><a href="#method-c-create">::create</a></li>
69
-
70
- <li><a href="#method-c-new">::new</a></li>
71
-
72
- <li><a href="#method-i-add">#add</a></li>
73
-
74
- <li><a href="#method-i-add_edges">#add_edges</a></li>
75
-
76
- <li><a href="#method-i-bfs">#bfs</a></li>
77
-
78
- <li><a href="#method-i-degree">#degree</a></li>
79
-
80
- <li><a href="#method-i-each_edge">#each_edge</a></li>
81
-
82
- <li><a href="#method-i-each_vertex">#each_vertex</a></li>
83
-
84
- <li><a href="#method-i-edge-3F">#edge?</a></li>
85
-
86
- <li><a href="#method-i-edge_size">#edge_size</a></li>
87
-
88
- <li><a href="#method-i-get_edge">#get_edge</a></li>
89
-
90
- <li><a href="#method-i-neighbors">#neighbors</a></li>
91
-
92
- <li><a href="#method-i-remove">#remove</a></li>
93
-
94
- <li><a href="#method-i-vertex_size">#vertex_size</a></li>
95
-
96
- </ul>
97
- </div>
98
-
99
-
100
-
101
- </div>
102
-
103
- <div id="project-metadata">
104
-
105
-
106
-
107
- <div id="classindex-section" class="section project-section">
108
- <h3 class="section-header">Class/Module Index
109
- <span class="search-toggle"><img src="../images/find.png"
110
- height="16" width="16" alt="[+]"
111
- title="show/hide quicksearch" /></span></h3>
112
- <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
113
- <fieldset>
114
- <legend>Quicksearch</legend>
115
- <input type="text" name="quicksearch" value=""
116
- class="quicksearch-field" />
117
- </fieldset>
118
- </form>
119
-
120
- <ul class="link-list">
121
-
122
- <li><a href="../DS.html">DS</a></li>
123
-
124
- <li><a href="../DS/Array2D.html">DS::Array2D</a></li>
125
-
126
- <li><a href="../DS/BinaryHeap.html">DS::BinaryHeap</a></li>
127
-
128
- <li><a href="../DS/BinarySearchTree.html">DS::BinarySearchTree</a></li>
129
-
130
- <li><a href="../DS/BinaryTree.html">DS::BinaryTree</a></li>
131
-
132
- <li><a href="../DS/CompleteBinaryTree.html">DS::CompleteBinaryTree</a></li>
133
-
134
- <li><a href="../DS/CyclicList.html">DS::CyclicList</a></li>
135
-
136
- <li><a href="../DS/Digraph.html">DS::Digraph</a></li>
137
-
138
- <li><a href="../DS/Edge.html">DS::Edge</a></li>
139
-
140
- <li><a href="../DS/ExpandableArray.html">DS::ExpandableArray</a></li>
141
-
142
- <li><a href="../DS/Graph.html">DS::Graph</a></li>
143
-
144
- <li><a href="../DS/GraphAsList.html">DS::GraphAsList</a></li>
145
-
146
- <li><a href="../DS/GraphAsMatrix.html">DS::GraphAsMatrix</a></li>
147
-
148
- <li><a href="../DS/GraphAsTriMatrix.html">DS::GraphAsTriMatrix</a></li>
149
-
150
- <li><a href="../DS/List.html">DS::List</a></li>
151
-
152
- <li><a href="../DS/ListElement.html">DS::ListElement</a></li>
153
-
154
- <li><a href="../DS/Queue.html">DS::Queue</a></li>
155
-
156
- <li><a href="../DS/Ring.html">DS::Ring</a></li>
157
-
158
- <li><a href="../DS/Stack.html">DS::Stack</a></li>
159
-
160
- <li><a href="../DS/Tree.html">DS::Tree</a></li>
161
-
162
- <li><a href="../DS/TreeWalker.html">DS::TreeWalker</a></li>
163
-
164
- <li><a href="../DS/TriMatrix.html">DS::TriMatrix</a></li>
165
-
166
- <li><a href="../Array.html">Array</a></li>
167
-
168
- </ul>
169
- <div id="no-class-search-results" style="display: none;">No matching classes.</div>
170
- </div>
171
-
172
-
173
- </div>
174
- </div>
175
-
176
- <div id="documentation">
177
- <h1 class="class">DS::Graph</h1>
178
-
179
- <div id="description" class="description">
180
-
181
- </div><!-- description -->
182
-
183
-
184
-
185
-
186
- <div id="5Buntitled-5D" class="documentation-section">
187
-
188
-
189
-
190
-
191
-
192
- <!-- Constants -->
193
- <div id="constants-list" class="section">
194
- <h3 class="section-header">Constants</h3>
195
- <dl>
196
-
197
- <dt><a name="Infinity">Infinity</a></dt>
198
-
199
- <dd class="description"></dd>
200
-
201
-
202
- </dl>
203
- </div>
204
-
205
-
206
-
207
-
208
- <!-- Methods -->
209
-
210
- <div id="public-class-method-details" class="method-section section">
211
- <h3 class="section-header">Public Class Methods</h3>
212
-
213
-
214
- <div id="create-method" class="method-detail ">
215
- <a name="method-c-create"></a>
216
-
217
-
218
- <div class="method-heading">
219
- <span class="method-name">create</span><span
220
- class="method-args">(edges)</span>
221
- <span class="method-click-advice">click to toggle source</span>
222
- </div>
223
-
224
-
225
- <div class="method-description">
226
-
227
- <p>Create new graph from array of edges. Internally graph will be represented
228
- by Triangular Matrix.</p>
229
-
230
-
231
-
232
- <div class="method-source-code" id="create-source">
233
- <pre>
234
- <span class="ruby-comment"># File ds/graphs/graph.rb, line 22</span>
235
- <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">edges</span>)
236
- <span class="ruby-identifier">new</span>(<span class="ruby-identifier">edges</span>,<span class="ruby-value">:tri_matrix</span>)
237
- <span class="ruby-keyword">end</span></pre>
238
- </div><!-- create-source -->
239
-
240
- </div>
241
-
242
-
243
-
244
-
245
- </div><!-- create-method -->
246
-
247
-
248
- <div id="new-method" class="method-detail ">
249
- <a name="method-c-new"></a>
250
-
251
-
252
- <div class="method-heading">
253
- <span class="method-name">new</span><span
254
- class="method-args">(edges,store = :list)</span>
255
- <span class="method-click-advice">click to toggle source</span>
256
- </div>
257
-
258
-
259
- <div class="method-description">
260
-
261
- <p>Create new graph from array of edges. Second parameter determines graph
262
- internal implementation: :list (Adjency <a href="List.html">List</a>),
263
- :tri_matrix (Triangular Matrix), :matrix (Matrix).</p>
264
-
265
-
266
-
267
- <div class="method-source-code" id="new-source">
268
- <pre>
269
- <span class="ruby-comment"># File ds/graphs/graph.rb, line 9</span>
270
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">edges</span>,<span class="ruby-identifier">store</span> = <span class="ruby-value">:list</span>)
271
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">store</span>
272
- <span class="ruby-keyword">when</span> <span class="ruby-value">:matrix</span>
273
- <span class="ruby-ivar">@g</span> = <span class="ruby-constant">GraphAsMatrix</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">edges</span>)
274
- <span class="ruby-keyword">when</span> <span class="ruby-value">:tri_matrix</span>
275
- <span class="ruby-ivar">@g</span> = <span class="ruby-constant">GraphAsTriMatrix</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">edges</span>)
276
- <span class="ruby-keyword">else</span>
277
- <span class="ruby-ivar">@g</span> = <span class="ruby-constant">GraphAsList</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">edges</span>)
278
- <span class="ruby-keyword">end</span>
279
- <span class="ruby-keyword">end</span></pre>
280
- </div><!-- new-source -->
281
-
282
- </div>
283
-
284
-
285
-
286
-
287
- </div><!-- new-method -->
288
-
289
-
290
- </div><!-- public-class-method-details -->
291
-
292
- <div id="public-instance-method-details" class="method-section section">
293
- <h3 class="section-header">Public Instance Methods</h3>
294
-
295
-
296
- <div id="add-method" class="method-detail ">
297
- <a name="method-i-add"></a>
298
-
299
-
300
- <div class="method-heading">
301
- <span class="method-name">add</span><span
302
- class="method-args">(x,y)</span>
303
- <span class="method-click-advice">click to toggle source</span>
304
- </div>
305
-
306
-
307
- <div class="method-description">
308
-
309
-
310
-
311
-
312
-
313
- <div class="method-source-code" id="add-source">
314
- <pre>
315
- <span class="ruby-comment"># File ds/graphs/graph.rb, line 26</span>
316
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">add</span>(<span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span>)
317
- <span class="ruby-ivar">@g</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span>)
318
- <span class="ruby-keyword">end</span></pre>
319
- </div><!-- add-source -->
320
-
321
- </div>
322
-
323
-
324
-
325
-
326
- </div><!-- add-method -->
327
-
328
-
329
- <div id="add_edges-method" class="method-detail ">
330
- <a name="method-i-add_edges"></a>
331
-
332
-
333
- <div class="method-heading">
334
- <span class="method-name">add_edges</span><span
335
- class="method-args">(edges)</span>
336
- <span class="method-click-advice">click to toggle source</span>
337
- </div>
338
-
339
-
340
- <div class="method-description">
341
-
342
-
343
-
344
-
345
-
346
- <div class="method-source-code" id="add_edges-source">
347
- <pre>
348
- <span class="ruby-comment"># File ds/graphs/graph.rb, line 81</span>
349
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">add_edges</span>(<span class="ruby-identifier">edges</span>)
350
- <span class="ruby-ivar">@g</span>.<span class="ruby-identifier">add_edges</span>(<span class="ruby-identifier">edges</span>)
351
- <span class="ruby-keyword">end</span></pre>
352
- </div><!-- add_edges-source -->
353
-
354
- </div>
355
-
356
-
357
-
358
-
359
- </div><!-- add_edges-method -->
360
-
361
-
362
- <div id="bfs-method" class="method-detail ">
363
- <a name="method-i-bfs"></a>
364
-
365
-
366
- <div class="method-heading">
367
- <span class="method-name">bfs</span><span
368
- class="method-args">(s)</span>
369
- <span class="method-click-advice">click to toggle source</span>
370
- </div>
371
-
372
-
373
- <div class="method-description">
374
-
375
-
376
-
377
-
378
-
379
- <div class="method-source-code" id="bfs-source">
380
- <pre>
381
- <span class="ruby-comment"># File ds/graphs/graph.rb, line 46</span>
382
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">bfs</span> <span class="ruby-identifier">s</span>
383
- <span class="ruby-identifier">colors</span> = {}
384
- <span class="ruby-identifier">parents</span> = {}
385
- <span class="ruby-identifier">res</span> = []
386
- <span class="ruby-identifier">d</span> = {}
387
- <span class="ruby-identifier">q</span> = <span class="ruby-constant">Queue</span>.<span class="ruby-identifier">new</span>
388
-
389
- <span class="ruby-ivar">@g</span>.<span class="ruby-identifier">each_vertex</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
390
- <span class="ruby-identifier">colors</span>[<span class="ruby-identifier">v</span>] = <span class="ruby-value">:white</span>
391
- <span class="ruby-identifier">parents</span>[<span class="ruby-identifier">v</span>] = <span class="ruby-keyword">nil</span>
392
- <span class="ruby-identifier">d</span>[<span class="ruby-identifier">v</span>] = <span class="ruby-constant">Infinity</span>
393
- <span class="ruby-keyword">end</span>
394
-
395
- <span class="ruby-identifier">colors</span>[<span class="ruby-identifier">s</span>] = <span class="ruby-value">:white</span>
396
- <span class="ruby-identifier">parents</span>[<span class="ruby-identifier">s</span>] = <span class="ruby-keyword">nil</span>
397
- <span class="ruby-identifier">d</span>[<span class="ruby-identifier">s</span>] = <span class="ruby-value">0</span>
398
-
399
- <span class="ruby-identifier">q</span>.<span class="ruby-identifier">enqueue</span> <span class="ruby-identifier">s</span>
400
-
401
- <span class="ruby-keyword">while</span> <span class="ruby-operator">!</span><span class="ruby-identifier">q</span>.<span class="ruby-identifier">empty?</span>
402
- <span class="ruby-identifier">u</span> = <span class="ruby-identifier">q</span>.<span class="ruby-identifier">dequeue</span>
403
- <span class="ruby-ivar">@g</span>.<span class="ruby-identifier">neighbors</span>(<span class="ruby-identifier">u</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>
404
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">colors</span>[<span class="ruby-identifier">v</span>] <span class="ruby-operator">===</span> <span class="ruby-value">:white</span>
405
- <span class="ruby-identifier">colors</span>[<span class="ruby-identifier">v</span>] = <span class="ruby-value">:grey</span>
406
- <span class="ruby-identifier">d</span>[<span class="ruby-identifier">v</span>] = <span class="ruby-identifier">d</span>[<span class="ruby-identifier">u</span>] <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
407
- <span class="ruby-identifier">parents</span>[<span class="ruby-identifier">v</span>] = <span class="ruby-identifier">u</span>
408
- <span class="ruby-identifier">q</span>.<span class="ruby-identifier">enqueue</span> <span class="ruby-identifier">v</span>
409
- <span class="ruby-keyword">end</span>
410
- <span class="ruby-keyword">end</span>
411
- <span class="ruby-identifier">colors</span>[<span class="ruby-identifier">u</span>] = <span class="ruby-value">:black</span>
412
- <span class="ruby-identifier">res</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">u</span>
413
- <span class="ruby-keyword">end</span>
414
- <span class="ruby-identifier">res</span>
415
- <span class="ruby-keyword">end</span></pre>
416
- </div><!-- bfs-source -->
417
-
418
- </div>
419
-
420
-
421
-
422
-
423
- </div><!-- bfs-method -->
424
-
425
-
426
- <div id="degree-method" class="method-detail ">
427
- <a name="method-i-degree"></a>
428
-
429
-
430
- <div class="method-heading">
431
- <span class="method-name">degree</span><span
432
- class="method-args">(x)</span>
433
- <span class="method-click-advice">click to toggle source</span>
434
- </div>
435
-
436
-
437
- <div class="method-description">
438
-
439
- <p>Returns vertex degree. Second parameter determines direction - :in incoming
440
- edges, :out - outcoming edges, :all - incoming and outcoming edges.</p>
441
-
442
-
443
-
444
- <div class="method-source-code" id="degree-source">
445
- <pre>
446
- <span class="ruby-comment"># File ds/graphs/graph.rb, line 87</span>
447
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">degree</span> <span class="ruby-identifier">x</span>
448
- <span class="ruby-ivar">@g</span>.<span class="ruby-identifier">degree</span> <span class="ruby-identifier">x</span>
449
- <span class="ruby-keyword">end</span></pre>
450
- </div><!-- degree-source -->
451
-
452
- </div>
453
-
454
-
455
-
456
-
457
- </div><!-- degree-method -->
458
-
459
-
460
- <div id="each_edge-method" class="method-detail ">
461
- <a name="method-i-each_edge"></a>
462
-
463
-
464
- <div class="method-heading">
465
- <span class="method-name">each_edge</span><span
466
- class="method-args">(&block)</span>
467
- <span class="method-click-advice">click to toggle source</span>
468
- </div>
469
-
470
-
471
- <div class="method-description">
472
-
473
-
474
-
475
-
476
-
477
- <div class="method-source-code" id="each_edge-source">
478
- <pre>
479
- <span class="ruby-comment"># File ds/graphs/graph.rb, line 38</span>
480
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">each_edge</span> &amp;<span class="ruby-identifier">block</span>
481
- <span class="ruby-ivar">@g</span>.<span class="ruby-identifier">each_edge</span> &amp;<span class="ruby-identifier">block</span>
482
- <span class="ruby-keyword">end</span></pre>
483
- </div><!-- each_edge-source -->
484
-
485
- </div>
486
-
487
-
488
-
489
-
490
- </div><!-- each_edge-method -->
491
-
492
-
493
- <div id="each_vertex-method" class="method-detail ">
494
- <a name="method-i-each_vertex"></a>
495
-
496
-
497
- <div class="method-heading">
498
- <span class="method-name">each_vertex</span><span
499
- class="method-args">(&block)</span>
500
- <span class="method-click-advice">click to toggle source</span>
501
- </div>
502
-
503
-
504
- <div class="method-description">
505
-
506
-
507
-
508
-
509
-
510
- <div class="method-source-code" id="each_vertex-source">
511
- <pre>
512
- <span class="ruby-comment"># File ds/graphs/graph.rb, line 34</span>
513
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">each_vertex</span> &amp;<span class="ruby-identifier">block</span>
514
- <span class="ruby-ivar">@g</span>.<span class="ruby-identifier">each_vertex</span> &amp;<span class="ruby-identifier">block</span>
515
- <span class="ruby-keyword">end</span></pre>
516
- </div><!-- each_vertex-source -->
517
-
518
- </div>
519
-
520
-
521
-
522
-
523
- </div><!-- each_vertex-method -->
524
-
525
-
526
- <div id="edge-3F-method" class="method-detail ">
527
- <a name="method-i-edge-3F"></a>
528
-
529
-
530
- <div class="method-heading">
531
- <span class="method-name">edge?</span><span
532
- class="method-args">(x,y)</span>
533
- <span class="method-click-advice">click to toggle source</span>
534
- </div>
535
-
536
-
537
- <div class="method-description">
538
-
539
-
540
-
541
-
542
-
543
- <div class="method-source-code" id="edge-3F-source">
544
- <pre>
545
- <span class="ruby-comment"># File ds/graphs/graph.rb, line 91</span>
546
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">edge?</span> <span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span>
547
- <span class="ruby-ivar">@g</span>.<span class="ruby-identifier">edge?</span> <span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span>
548
- <span class="ruby-keyword">end</span></pre>
549
- </div><!-- edge-3F-source -->
550
-
551
- </div>
552
-
553
-
554
-
555
-
556
- </div><!-- edge-3F-method -->
557
-
558
-
559
- <div id="edge_size-method" class="method-detail ">
560
- <a name="method-i-edge_size"></a>
561
-
562
-
563
- <div class="method-heading">
564
- <span class="method-name">edge_size</span><span
565
- class="method-args">()</span>
566
- <span class="method-click-advice">click to toggle source</span>
567
- </div>
568
-
569
-
570
- <div class="method-description">
571
-
572
-
573
-
574
-
575
-
576
- <div class="method-source-code" id="edge_size-source">
577
- <pre>
578
- <span class="ruby-comment"># File ds/graphs/graph.rb, line 103</span>
579
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">edge_size</span>
580
- <span class="ruby-ivar">@g</span>.<span class="ruby-identifier">vmax</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>
581
- <span class="ruby-keyword">end</span></pre>
582
- </div><!-- edge_size-source -->
583
-
584
- </div>
585
-
586
-
587
-
588
-
589
- </div><!-- edge_size-method -->
590
-
591
-
592
- <div id="get_edge-method" class="method-detail ">
593
- <a name="method-i-get_edge"></a>
594
-
595
-
596
- <div class="method-heading">
597
- <span class="method-name">get_edge</span><span
598
- class="method-args">(x, y)</span>
599
- <span class="method-click-advice">click to toggle source</span>
600
- </div>
601
-
602
-
603
- <div class="method-description">
604
-
605
-
606
-
607
-
608
-
609
- <div class="method-source-code" id="get_edge-source">
610
- <pre>
611
- <span class="ruby-comment"># File ds/graphs/graph.rb, line 95</span>
612
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">get_edge</span> <span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>
613
- <span class="ruby-ivar">@g</span>.<span class="ruby-identifier">get_edge</span> <span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span>
614
- <span class="ruby-keyword">end</span></pre>
615
- </div><!-- get_edge-source -->
616
-
617
- </div>
618
-
619
-
620
-
621
-
622
- </div><!-- get_edge-method -->
623
-
624
-
625
- <div id="neighbors-method" class="method-detail ">
626
- <a name="method-i-neighbors"></a>
627
-
628
-
629
- <div class="method-heading">
630
- <span class="method-name">neighbors</span><span
631
- class="method-args">(v)</span>
632
- <span class="method-click-advice">click to toggle source</span>
633
- </div>
634
-
635
-
636
- <div class="method-description">
637
-
638
-
639
-
640
-
641
-
642
- <div class="method-source-code" id="neighbors-source">
643
- <pre>
644
- <span class="ruby-comment"># File ds/graphs/graph.rb, line 42</span>
645
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">neighbors</span> <span class="ruby-identifier">v</span>
646
- <span class="ruby-ivar">@g</span>.<span class="ruby-identifier">neighbors</span> <span class="ruby-identifier">v</span>
647
- <span class="ruby-keyword">end</span></pre>
648
- </div><!-- neighbors-source -->
649
-
650
- </div>
651
-
652
-
653
-
654
-
655
- </div><!-- neighbors-method -->
656
-
657
-
658
- <div id="remove-method" class="method-detail ">
659
- <a name="method-i-remove"></a>
660
-
661
-
662
- <div class="method-heading">
663
- <span class="method-name">remove</span><span
664
- class="method-args">(x,y)</span>
665
- <span class="method-click-advice">click to toggle source</span>
666
- </div>
667
-
668
-
669
- <div class="method-description">
670
-
671
-
672
-
673
-
674
-
675
- <div class="method-source-code" id="remove-source">
676
- <pre>
677
- <span class="ruby-comment"># File ds/graphs/graph.rb, line 30</span>
678
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">remove</span>(<span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span>)
679
- <span class="ruby-ivar">@g</span>.<span class="ruby-identifier">remove</span>(<span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span>)
680
- <span class="ruby-keyword">end</span></pre>
681
- </div><!-- remove-source -->
682
-
683
- </div>
684
-
685
-
686
-
687
-
688
- </div><!-- remove-method -->
689
-
690
-
691
- <div id="vertex_size-method" class="method-detail ">
692
- <a name="method-i-vertex_size"></a>
693
-
694
-
695
- <div class="method-heading">
696
- <span class="method-name">vertex_size</span><span
697
- class="method-args">()</span>
698
- <span class="method-click-advice">click to toggle source</span>
699
- </div>
700
-
701
-
702
- <div class="method-description">
703
-
704
-
705
-
706
-
707
-
708
- <div class="method-source-code" id="vertex_size-source">
709
- <pre>
710
- <span class="ruby-comment"># File ds/graphs/graph.rb, line 99</span>
711
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">vertex_size</span>
712
- <span class="ruby-ivar">@g</span>.<span class="ruby-identifier">vertex_size</span>
713
- <span class="ruby-keyword">end</span></pre>
714
- </div><!-- vertex_size-source -->
715
-
716
- </div>
717
-
718
-
719
-
720
-
721
- </div><!-- vertex_size-method -->
722
-
723
-
724
- </div><!-- public-instance-method-details -->
725
-
726
- </div><!-- 5Buntitled-5D -->
727
-
728
-
729
- </div><!-- documentation -->
730
-
731
- <div id="validator-badges">
732
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
733
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
734
- Rdoc Generator</a> 2</small>.</p>
735
- </div>
736
-
737
- </body>
738
- </html>
739
-