jumoku 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/Gemfile +1 -1
  2. data/README.md +12 -12
  3. data/lib/jumoku.rb +2 -2
  4. data/lib/jumoku/builders/raw_tree.rb +4 -4
  5. data/lib/jumoku/builders/tree.rb +5 -5
  6. data/lib/jumoku/support/branch.rb +1 -1
  7. data/lib/jumoku/tree_api.rb +1 -1
  8. data/lib/jumoku/version.rb +1 -1
  9. data/spec/raw_tree_spec.rb +1 -1
  10. data/vendor/git/{graphy → plexus}/CREDITS.md +0 -0
  11. data/vendor/git/plexus/Gemfile +3 -0
  12. data/vendor/git/plexus/Gemfile.lock +28 -0
  13. data/vendor/git/{graphy → plexus}/LICENSE +3 -1
  14. data/vendor/git/plexus/README.md +208 -0
  15. data/vendor/git/plexus/Rakefile +25 -0
  16. data/vendor/git/{graphy → plexus}/TODO.md +1 -1
  17. data/vendor/git/{graphy → plexus}/VERSION +0 -0
  18. data/vendor/git/{graphy → plexus}/examples/graph_self.rb +0 -0
  19. data/vendor/git/{graphy → plexus}/examples/module_graph.jpg +0 -0
  20. data/vendor/git/{graphy → plexus}/examples/module_graph.rb +0 -0
  21. data/vendor/git/{graphy → plexus}/examples/self_graph.jpg +0 -0
  22. data/vendor/git/{graphy → plexus}/examples/visualize.jpg +0 -0
  23. data/vendor/git/{graphy → plexus}/examples/visualize.rb +0 -0
  24. data/vendor/git/plexus/lib/plexus.rb +90 -0
  25. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/adjacency_graph.rb +9 -9
  26. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/arc.rb +16 -22
  27. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/arc_number.rb +2 -2
  28. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/biconnected.rb +2 -2
  29. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/chinese_postman.rb +2 -2
  30. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/classes/graph_classes.rb +10 -10
  31. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/common.rb +6 -6
  32. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/comparability.rb +10 -10
  33. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/directed_graph.rb +15 -13
  34. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/directed_graph/algorithms.rb +21 -18
  35. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/directed_graph/distance.rb +2 -2
  36. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/dot.rb +2 -2
  37. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/edge.rb +8 -9
  38. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/ext.rb +3 -3
  39. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/graph.rb +51 -56
  40. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/graph_api.rb +2 -2
  41. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/labels.rb +8 -8
  42. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/maximum_flow.rb +2 -2
  43. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/ruby_compatibility.rb +0 -0
  44. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/search.rb +43 -44
  45. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/strong_components.rb +4 -4
  46. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/support/support.rb +3 -3
  47. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/undirected_graph.rb +13 -14
  48. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/undirected_graph/algorithms.rb +4 -4
  49. data/vendor/git/plexus/lib/plexus/version.rb +6 -0
  50. data/vendor/git/plexus/plexus.gemspec +24 -0
  51. data/vendor/git/{graphy → plexus}/spec/biconnected_spec.rb +0 -0
  52. data/vendor/git/{graphy → plexus}/spec/chinese_postman_spec.rb +0 -0
  53. data/vendor/git/{graphy → plexus}/spec/community_spec.rb +0 -0
  54. data/vendor/git/{graphy → plexus}/spec/complement_spec.rb +0 -0
  55. data/vendor/git/{graphy → plexus}/spec/digraph_distance_spec.rb +0 -0
  56. data/vendor/git/{graphy → plexus}/spec/digraph_spec.rb +0 -0
  57. data/vendor/git/{graphy → plexus}/spec/dot_spec.rb +0 -0
  58. data/vendor/git/{graphy → plexus}/spec/edge_spec.rb +17 -18
  59. data/vendor/git/{graphy → plexus}/spec/inspection_spec.rb +13 -15
  60. data/vendor/git/{graphy → plexus}/spec/multi_edge_spec.rb +0 -0
  61. data/vendor/git/{graphy → plexus}/spec/neighborhood_spec.rb +3 -5
  62. data/vendor/git/{graphy → plexus}/spec/properties_spec.rb +1 -1
  63. data/vendor/git/{graphy → plexus}/spec/search_spec.rb +45 -45
  64. data/vendor/git/{graphy → plexus}/spec/spec.opts +0 -0
  65. data/vendor/git/{graphy → plexus}/spec/spec_helper.rb +13 -10
  66. data/vendor/git/{graphy → plexus}/spec/strong_components_spec.rb +0 -0
  67. data/vendor/git/{graphy → plexus}/spec/triangulated_spec.rb +1 -1
  68. data/vendor/git/{graphy → plexus}/spec/undirected_graph_spec.rb +0 -0
  69. data/vendor/git/{graphy → plexus}/vendor/priority-queue/CHANGELOG +0 -0
  70. data/vendor/git/{graphy → plexus}/vendor/priority-queue/Makefile +0 -0
  71. data/vendor/git/{graphy → plexus}/vendor/priority-queue/README +0 -0
  72. data/vendor/git/{graphy → plexus}/vendor/priority-queue/benchmark/dijkstra.rb +0 -0
  73. data/vendor/git/{graphy → plexus}/vendor/priority-queue/compare_comments.rb +0 -0
  74. data/vendor/git/{graphy → plexus}/vendor/priority-queue/doc/c-vs-rb.png +0 -0
  75. data/vendor/git/{graphy → plexus}/vendor/priority-queue/doc/compare_big.gp +0 -0
  76. data/vendor/git/{graphy → plexus}/vendor/priority-queue/doc/compare_big.png +0 -0
  77. data/vendor/git/{graphy → plexus}/vendor/priority-queue/doc/compare_small.gp +0 -0
  78. data/vendor/git/{graphy → plexus}/vendor/priority-queue/doc/compare_small.png +0 -0
  79. data/vendor/git/{graphy → plexus}/vendor/priority-queue/doc/results.csv +0 -0
  80. data/vendor/git/{graphy → plexus}/vendor/priority-queue/ext/priority_queue/CPriorityQueue/extconf.rb +0 -0
  81. data/vendor/git/{graphy → plexus}/vendor/priority-queue/ext/priority_queue/CPriorityQueue/priority_queue.c +0 -0
  82. data/vendor/git/{graphy → plexus}/vendor/priority-queue/lib/priority_queue.rb +0 -0
  83. data/vendor/git/{graphy → plexus}/vendor/priority-queue/lib/priority_queue/c_priority_queue.rb +0 -0
  84. data/vendor/git/{graphy → plexus}/vendor/priority-queue/lib/priority_queue/poor_priority_queue.rb +0 -0
  85. data/vendor/git/{graphy → plexus}/vendor/priority-queue/lib/priority_queue/ruby_priority_queue.rb +0 -0
  86. data/vendor/git/{graphy → plexus}/vendor/priority-queue/priority_queue.so +0 -0
  87. data/vendor/git/{graphy → plexus}/vendor/priority-queue/setup.rb +0 -0
  88. data/vendor/git/{graphy → plexus}/vendor/priority-queue/test/priority_queue_test.rb +0 -0
  89. data/vendor/git/{graphy → plexus}/vendor/rdot.rb +0 -0
  90. metadata +81 -78
  91. data/vendor/git/graphy/README.md +0 -186
  92. data/vendor/git/graphy/Rakefile +0 -61
  93. data/vendor/git/graphy/graphy.gemspec +0 -149
  94. data/vendor/git/graphy/lib/graphy.rb +0 -90
@@ -100,7 +100,7 @@ describe "Triangulated" do #:nodoc:
100
100
 
101
101
  describe "lexicographic_queue" do
102
102
  it do
103
- q = Graphy::Search::LexicographicQueue.new([1,2,3,4,5,6,7,8,9])
103
+ q = Plexus::Search::LexicographicQueue.new([1,2,3,4,5,6,7,8,9])
104
104
  q.pop.should == 9
105
105
  q.add_lexeme([3,4,5,6,7,8])
106
106
  q.pop.should == 8
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jumoku
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.2
5
+ version: 0.1.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jean-Denis Vauguet <jd@vauguet.fr>
@@ -76,83 +76,86 @@ files:
76
76
  - lib/jumoku/support/support.rb
77
77
  - lib/jumoku/support/branch.rb
78
78
  - lib/jumoku/version.rb
79
- - vendor/git/graphy/LICENSE
80
- - vendor/git/graphy/lib/graphy/biconnected.rb
81
- - vendor/git/graphy/lib/graphy/arc.rb
82
- - vendor/git/graphy/lib/graphy/ruby_compatibility.rb
83
- - vendor/git/graphy/lib/graphy/dot.rb
84
- - vendor/git/graphy/lib/graphy/directed_graph.rb
85
- - vendor/git/graphy/lib/graphy/comparability.rb
86
- - vendor/git/graphy/lib/graphy/chinese_postman.rb
87
- - vendor/git/graphy/lib/graphy/graph_api.rb
88
- - vendor/git/graphy/lib/graphy/classes/graph_classes.rb
89
- - vendor/git/graphy/lib/graphy/strong_components.rb
90
- - vendor/git/graphy/lib/graphy/support/support.rb
91
- - vendor/git/graphy/lib/graphy/common.rb
92
- - vendor/git/graphy/lib/graphy/search.rb
93
- - vendor/git/graphy/lib/graphy/arc_number.rb
94
- - vendor/git/graphy/lib/graphy/maximum_flow.rb
95
- - vendor/git/graphy/lib/graphy/ext.rb
96
- - vendor/git/graphy/lib/graphy/labels.rb
97
- - vendor/git/graphy/lib/graphy/undirected_graph.rb
98
- - vendor/git/graphy/lib/graphy/edge.rb
99
- - vendor/git/graphy/lib/graphy/directed_graph/distance.rb
100
- - vendor/git/graphy/lib/graphy/directed_graph/algorithms.rb
101
- - vendor/git/graphy/lib/graphy/undirected_graph/algorithms.rb
102
- - vendor/git/graphy/lib/graphy/adjacency_graph.rb
103
- - vendor/git/graphy/lib/graphy/graph.rb
104
- - vendor/git/graphy/lib/graphy.rb
105
- - vendor/git/graphy/graphy.gemspec
106
- - vendor/git/graphy/Rakefile
107
- - vendor/git/graphy/VERSION
108
- - vendor/git/graphy/TODO.md
109
- - vendor/git/graphy/spec/spec.opts
110
- - vendor/git/graphy/spec/edge_spec.rb
111
- - vendor/git/graphy/spec/inspection_spec.rb
112
- - vendor/git/graphy/spec/digraph_spec.rb
113
- - vendor/git/graphy/spec/spec_helper.rb
114
- - vendor/git/graphy/spec/search_spec.rb
115
- - vendor/git/graphy/spec/triangulated_spec.rb
116
- - vendor/git/graphy/spec/multi_edge_spec.rb
117
- - vendor/git/graphy/spec/dot_spec.rb
118
- - vendor/git/graphy/spec/neighborhood_spec.rb
119
- - vendor/git/graphy/spec/complement_spec.rb
120
- - vendor/git/graphy/spec/biconnected_spec.rb
121
- - vendor/git/graphy/spec/undirected_graph_spec.rb
122
- - vendor/git/graphy/spec/chinese_postman_spec.rb
123
- - vendor/git/graphy/spec/strong_components_spec.rb
124
- - vendor/git/graphy/spec/community_spec.rb
125
- - vendor/git/graphy/spec/digraph_distance_spec.rb
126
- - vendor/git/graphy/spec/properties_spec.rb
127
- - vendor/git/graphy/examples/module_graph.rb
128
- - vendor/git/graphy/examples/self_graph.jpg
129
- - vendor/git/graphy/examples/visualize.rb
130
- - vendor/git/graphy/examples/visualize.jpg
131
- - vendor/git/graphy/examples/graph_self.rb
132
- - vendor/git/graphy/examples/module_graph.jpg
133
- - vendor/git/graphy/README.md
134
- - vendor/git/graphy/vendor/priority-queue/ext/priority_queue/CPriorityQueue/priority_queue.c
135
- - vendor/git/graphy/vendor/priority-queue/ext/priority_queue/CPriorityQueue/extconf.rb
136
- - vendor/git/graphy/vendor/priority-queue/README
137
- - vendor/git/graphy/vendor/priority-queue/Makefile
138
- - vendor/git/graphy/vendor/priority-queue/lib/priority_queue/c_priority_queue.rb
139
- - vendor/git/graphy/vendor/priority-queue/lib/priority_queue/poor_priority_queue.rb
140
- - vendor/git/graphy/vendor/priority-queue/lib/priority_queue/ruby_priority_queue.rb
141
- - vendor/git/graphy/vendor/priority-queue/lib/priority_queue.rb
142
- - vendor/git/graphy/vendor/priority-queue/benchmark/dijkstra.rb
143
- - vendor/git/graphy/vendor/priority-queue/CHANGELOG
144
- - vendor/git/graphy/vendor/priority-queue/doc/compare_big.gp
145
- - vendor/git/graphy/vendor/priority-queue/doc/compare_small.png
146
- - vendor/git/graphy/vendor/priority-queue/doc/compare_small.gp
147
- - vendor/git/graphy/vendor/priority-queue/doc/results.csv
148
- - vendor/git/graphy/vendor/priority-queue/doc/c-vs-rb.png
149
- - vendor/git/graphy/vendor/priority-queue/doc/compare_big.png
150
- - vendor/git/graphy/vendor/priority-queue/priority_queue.so
151
- - vendor/git/graphy/vendor/priority-queue/test/priority_queue_test.rb
152
- - vendor/git/graphy/vendor/priority-queue/setup.rb
153
- - vendor/git/graphy/vendor/priority-queue/compare_comments.rb
154
- - vendor/git/graphy/vendor/rdot.rb
155
- - vendor/git/graphy/CREDITS.md
79
+ - vendor/git/plexus/LICENSE
80
+ - vendor/git/plexus/lib/plexus/biconnected.rb
81
+ - vendor/git/plexus/lib/plexus/arc.rb
82
+ - vendor/git/plexus/lib/plexus/ruby_compatibility.rb
83
+ - vendor/git/plexus/lib/plexus/dot.rb
84
+ - vendor/git/plexus/lib/plexus/directed_graph.rb
85
+ - vendor/git/plexus/lib/plexus/comparability.rb
86
+ - vendor/git/plexus/lib/plexus/chinese_postman.rb
87
+ - vendor/git/plexus/lib/plexus/graph_api.rb
88
+ - vendor/git/plexus/lib/plexus/classes/graph_classes.rb
89
+ - vendor/git/plexus/lib/plexus/strong_components.rb
90
+ - vendor/git/plexus/lib/plexus/support/support.rb
91
+ - vendor/git/plexus/lib/plexus/common.rb
92
+ - vendor/git/plexus/lib/plexus/search.rb
93
+ - vendor/git/plexus/lib/plexus/arc_number.rb
94
+ - vendor/git/plexus/lib/plexus/maximum_flow.rb
95
+ - vendor/git/plexus/lib/plexus/ext.rb
96
+ - vendor/git/plexus/lib/plexus/labels.rb
97
+ - vendor/git/plexus/lib/plexus/undirected_graph.rb
98
+ - vendor/git/plexus/lib/plexus/edge.rb
99
+ - vendor/git/plexus/lib/plexus/directed_graph/distance.rb
100
+ - vendor/git/plexus/lib/plexus/directed_graph/algorithms.rb
101
+ - vendor/git/plexus/lib/plexus/undirected_graph/algorithms.rb
102
+ - vendor/git/plexus/lib/plexus/adjacency_graph.rb
103
+ - vendor/git/plexus/lib/plexus/version.rb
104
+ - vendor/git/plexus/lib/plexus/graph.rb
105
+ - vendor/git/plexus/lib/plexus.rb
106
+ - vendor/git/plexus/Rakefile
107
+ - vendor/git/plexus/VERSION
108
+ - vendor/git/plexus/TODO.md
109
+ - vendor/git/plexus/plexus.gemspec
110
+ - vendor/git/plexus/spec/spec.opts
111
+ - vendor/git/plexus/spec/edge_spec.rb
112
+ - vendor/git/plexus/spec/inspection_spec.rb
113
+ - vendor/git/plexus/spec/digraph_spec.rb
114
+ - vendor/git/plexus/spec/spec_helper.rb
115
+ - vendor/git/plexus/spec/search_spec.rb
116
+ - vendor/git/plexus/spec/triangulated_spec.rb
117
+ - vendor/git/plexus/spec/multi_edge_spec.rb
118
+ - vendor/git/plexus/spec/dot_spec.rb
119
+ - vendor/git/plexus/spec/neighborhood_spec.rb
120
+ - vendor/git/plexus/spec/complement_spec.rb
121
+ - vendor/git/plexus/spec/biconnected_spec.rb
122
+ - vendor/git/plexus/spec/undirected_graph_spec.rb
123
+ - vendor/git/plexus/spec/chinese_postman_spec.rb
124
+ - vendor/git/plexus/spec/strong_components_spec.rb
125
+ - vendor/git/plexus/spec/community_spec.rb
126
+ - vendor/git/plexus/spec/digraph_distance_spec.rb
127
+ - vendor/git/plexus/spec/properties_spec.rb
128
+ - vendor/git/plexus/Gemfile.lock
129
+ - vendor/git/plexus/examples/module_graph.rb
130
+ - vendor/git/plexus/examples/self_graph.jpg
131
+ - vendor/git/plexus/examples/visualize.rb
132
+ - vendor/git/plexus/examples/visualize.jpg
133
+ - vendor/git/plexus/examples/graph_self.rb
134
+ - vendor/git/plexus/examples/module_graph.jpg
135
+ - vendor/git/plexus/README.md
136
+ - vendor/git/plexus/vendor/priority-queue/ext/priority_queue/CPriorityQueue/priority_queue.c
137
+ - vendor/git/plexus/vendor/priority-queue/ext/priority_queue/CPriorityQueue/extconf.rb
138
+ - vendor/git/plexus/vendor/priority-queue/README
139
+ - vendor/git/plexus/vendor/priority-queue/Makefile
140
+ - vendor/git/plexus/vendor/priority-queue/lib/priority_queue/c_priority_queue.rb
141
+ - vendor/git/plexus/vendor/priority-queue/lib/priority_queue/poor_priority_queue.rb
142
+ - vendor/git/plexus/vendor/priority-queue/lib/priority_queue/ruby_priority_queue.rb
143
+ - vendor/git/plexus/vendor/priority-queue/lib/priority_queue.rb
144
+ - vendor/git/plexus/vendor/priority-queue/benchmark/dijkstra.rb
145
+ - vendor/git/plexus/vendor/priority-queue/CHANGELOG
146
+ - vendor/git/plexus/vendor/priority-queue/doc/compare_big.gp
147
+ - vendor/git/plexus/vendor/priority-queue/doc/compare_small.png
148
+ - vendor/git/plexus/vendor/priority-queue/doc/compare_small.gp
149
+ - vendor/git/plexus/vendor/priority-queue/doc/results.csv
150
+ - vendor/git/plexus/vendor/priority-queue/doc/c-vs-rb.png
151
+ - vendor/git/plexus/vendor/priority-queue/doc/compare_big.png
152
+ - vendor/git/plexus/vendor/priority-queue/priority_queue.so
153
+ - vendor/git/plexus/vendor/priority-queue/test/priority_queue_test.rb
154
+ - vendor/git/plexus/vendor/priority-queue/setup.rb
155
+ - vendor/git/plexus/vendor/priority-queue/compare_comments.rb
156
+ - vendor/git/plexus/vendor/rdot.rb
157
+ - vendor/git/plexus/Gemfile
158
+ - vendor/git/plexus/CREDITS.md
156
159
  - spec/spec.opts
157
160
  - spec/raw_tree_spec.rb
158
161
  - spec/spec_helper.rb
@@ -1,186 +0,0 @@
1
- # Graphy. A framework for graph theory, graph data structures and associated algorithms.
2
-
3
- Graph algorithms currently provided are:
4
-
5
- * Topological Sort
6
- * Strongly Connected Components
7
- * Transitive Closure
8
- * Rural Chinese Postman
9
- * Biconnected
10
-
11
- These are based on more general algorithm patterns:
12
-
13
- * Breadth First Search
14
- * Depth First Search
15
- * A* Search
16
- * Floyd-Warshall
17
- * Best First Search
18
- * Djikstra's Algorithm
19
- * Lexicographic Search
20
-
21
- ## A quick Tour
22
-
23
- ### Arcs
24
-
25
- There are two vertices bound classes, `Graphy::Arc` and `Graphy::Edge`. The
26
- former defines directional edges, the latter undirected edges.
27
-
28
- ### Vertices
29
-
30
- Vertices can be any `Object`.
31
-
32
- ### Graph Types
33
-
34
- There are a number of different graph types, each of which provide
35
- different features and constraints:
36
-
37
- `Graphy::Digraph` and its alias `Graphy::DirectedGraph`:
38
-
39
- * Single directed edges (arcs) between vertices
40
- * Loops are forbidden
41
-
42
- `Graphy::DirectedPseudoGraph`:
43
-
44
- * Multiple directed edges (arcs) between vertices
45
- * Loops are forbidden
46
-
47
- `Graphy::DirectedMultiGraph`:
48
-
49
- * Multiple directed edges (arcs) between vertices
50
- * Loops on vertices
51
-
52
- `Graphy::UndirectedGraph`, `Graphy::UndirectedPseudoGraph`, and
53
- `Graph::UndirectedMultiGraph` are similar but all edges are undirected.
54
-
55
- ### Data Structures
56
-
57
- In order to modelize data structures, make use of the `Graphy::AdjacencyGraph`
58
- module which provides a generalized adjacency list and an edge list adaptor.
59
-
60
- The `Graphy::Digraph` class is the general purpose "swiss army knife" of graph
61
- classes, most of the other classes are just modifications to this class.
62
- It is optimized for efficient access to just the out-edges, fast vertex
63
- insertion and removal at the cost of extra space overhead, etc.
64
-
65
- ## Example Usage
66
-
67
- Using IRB, first require the library:
68
-
69
- require 'rubygems' # only if you are using ruby 1.8.x
70
- require 'graphy'
71
-
72
- If you'd like to include all the classes in the current scope (so you
73
- don't have to prefix with `Graphy::`), just:
74
-
75
- include Graphy
76
-
77
- Let's play with the library a bit in IRB:
78
-
79
- >> dg = Digraph[1,2, 2,3, 2,4, 4,5, 6,4, 1,6]
80
- => Graphy::Digraph[[2, 3], [1, 6], [2, 4], [4, 5], [1, 2], [6, 4]]
81
-
82
- A few properties of the graph we just created:
83
-
84
- >> dg.directed?
85
- => true
86
- >> dg.vertex?(4)
87
- => true
88
- >> dg.edge?(2,4)
89
- => true
90
- >> dg.edge?(4,2)
91
- => false
92
- >> dg.vertices
93
- => [1, 2, 3, 4, 5, 6]
94
-
95
- Every object could be a vertex, even the class object `Object`:
96
-
97
- >> dg.vertex?(Object)
98
- => false
99
-
100
- >> UndirectedGraph.new(dg).edges.sort.to_s
101
- => "[Graphy::Edge[1,2,nil], Graphy::Edge[2,3,nil], Graphy::Edge[2,4,nil],
102
- Graphy::Edge[4,5,nil], Graphy::Edge[1,6,nil], Graphy::Edge[6,4,nil]]"
103
-
104
- Add inverse edge `(4-2)` to directed graph:
105
-
106
- >> dg.add_edge!(4,2)
107
- => Graphy::DirectedGraph[Graphy::Arc[1,2,nil], Graphy::Arc[1,6,nil], Graphy::Arc[2,3,nil],
108
- Graphy::Arc[2,4,nil], Graphy::Arc[4,5,nil], Graphy::Arc[4,2,nil],
109
- Graphy::Arc[6,4,nil]]
110
-
111
- `(4-2) == (2-4)` in the undirected graph (4-2 doesn't show up):
112
-
113
- >> UndirectedGraph.new(dg).edges.sort.to_s
114
- => "[Graphy::Edge[1,2,nil], Graphy::Edge[2,3,nil], Graphy::Edge[2,4,nil],
115
- Graphy::Edge[4,5,nil], Graphy::Edge[1,6,nil], Graphy::Edge[6,4,nil]]"
116
-
117
- `(4-2) != (2-4)` in directed graphs (both show up):
118
-
119
- >> dg.edges.sort.to_s
120
- => "[Graphy::Arc[1,2,nil], Graphy::Arc[1,6,nil], Graphy::Arc[2,3,nil],
121
- Graphy::Arc[2,4,nil], Graphy::Arc[4,2,nil], Graphy::Arc[4,5,nil],
122
- Graphy::Arc[6,4,nil]]"
123
-
124
- >> dg.remove_edge! 4,2
125
- => Graphy::DirectedGraph[Graphy::Arc[1,2,nil], Graphy::Arc[1,6,nil], Graphy::Arc[2,3,nil],
126
- Graphy::Arc[2,4,nil], Graphy::Arc[4,5,nil], Graphy::Arc[6,4,nil]]
127
-
128
- Topological sorting is realized with an iterator:
129
-
130
- >> dg.topsort
131
- => [1, 6, 2, 4, 5, 3]
132
- >> y = 0; dg.topsort { |v| y += v }; y
133
- => 21
134
-
135
- You can use DOT to visualize the graph:
136
-
137
- >> require 'graphy/dot'
138
- >> dg.write_to_graphic_file('jpg','visualize')
139
-
140
- Here's an example showing the module inheritance hierarchy:
141
-
142
- >> module_graph = Digraph.new
143
- >> ObjectSpace.each_object(Module) do |m|
144
- >> m.ancestors.each {|a| module_graph.add_edge!(m,a) if m != a}
145
- >> end
146
- >> gv = module_graph.vertices.select {|v| v.to_s.match(/Graphy/) }
147
- >> module_graph.induced_subgraph(gv).write_to_graphic_file('jpg','module_graph')
148
-
149
- Look for more in the examples directory.
150
-
151
- ## History
152
-
153
- This library is based on [GRATR][1] by Shawn Garbett (itself a fork of
154
- Horst Duchene's [RGL][2] library) which is heavily influenced by the [Boost][3]
155
- Graph Library (BGL).
156
-
157
- This fork attempts to modernize and extend the API and tests.
158
-
159
- ## References
160
-
161
- For more information on Graph Theory, you may want to read:
162
-
163
- * the [documentation][3] for the Boost Graph Library
164
- * [the Dictionary of Algorithms and Data Structures][4]
165
-
166
- ## Credits
167
-
168
- See CREDITS.markdown
169
-
170
- ## TODO
171
-
172
- See TODO.markdown
173
-
174
- ## CHANGELOG
175
-
176
- See CHANGELOG.markdown
177
-
178
- ## License
179
-
180
- See LICENSE
181
-
182
- [1]: http://gratr.rubyforge.org
183
- [2]: http://rgl.rubyforge.org
184
- [3]: http://www.boost.org/libs/graph/doc
185
- [4]: http://www.nist.gov/dads/HTML/graph.html
186
-
@@ -1,61 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'yard'
4
-
5
- begin
6
- require 'jeweler'
7
- Jeweler::Tasks.new do |gem|
8
- gem.name = "graphy"
9
- gem.summary = "A Graph Theory Ruby library"
10
- gem.description =<<-EOD
11
- A framework for graph data structures and algorithms.
12
-
13
- This library is based on GRATR and RGL.
14
-
15
- Graph algorithms currently provided are:
16
-
17
- * Topological Sort
18
- * Strongly Connected Components
19
- * Transitive Closure
20
- * Rural Chinese Postman
21
- * Biconnected
22
- EOD
23
- gem.email = "bruce@codefluency.com"
24
- gem.homepage = "http://github.com/bruce/graphy"
25
- gem.authors = ["Bruce Williams"]
26
- end
27
- Jeweler::GemcutterTasks.new
28
- rescue LoadError
29
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
30
- end
31
-
32
- require 'rake/rdoctask'
33
- Rake::RDocTask.new do |rdoc|
34
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
35
-
36
- rdoc.rdoc_dir = 'rdoc'
37
- rdoc.title = "graphy #{version}"
38
- rdoc.rdoc_files.include('README*')
39
- rdoc.rdoc_files.include('lib/**/*.rb')
40
- end
41
-
42
- #require 'spec/rake/spectask'
43
- #Spec::Rake::SpecTask.new(:spec) do |spec|
44
- #spec.libs << 'lib' << 'spec'
45
- #spec.spec_files = FileList['spec/**/*_spec.rb']
46
- #end
47
-
48
- #Spec::Rake::SpecTask.new(:rcov) do |spec|
49
- #spec.libs << 'lib' << 'spec'
50
- #spec.pattern = 'spec/**/*_spec.rb'
51
- #spec.rcov = true
52
- #end
53
-
54
- #task :spec => :check_dependencies
55
-
56
- #task :default => :spec
57
-
58
- YARD::Rake::YardocTask.new do |t|
59
- t.files = ['lib/**/*.rb', 'README.md', 'TODO.md', 'CREDITS.md', 'LICENSE', 'VERSION']
60
- #t.options = ['--any', '--extra', '--opts'] # optional
61
- end