plexus 0.5.8 → 0.5.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -208,6 +208,7 @@ module Plexus
208
208
  # @fixme
209
209
  def adjacent(x, options = {})
210
210
  options[:direction] ||= :out
211
+
211
212
  if !x.is_a?(Plexus::Arc) and (options[:direction] == :out || !directed?)
212
213
  if options[:type] == :edges
213
214
  i = -1
@@ -68,26 +68,26 @@ module Plexus
68
68
  out_degree(v) - in_degree(v)
69
69
  end
70
70
 
71
- def community(node, direction)
71
+ def community(node, direction, options = {:recursive => true})
72
72
  nodes, stack = {}, adjacent(node, :direction => direction)
73
73
  while n = stack.pop
74
74
  unless nodes[n.object_id] || node == n
75
75
  nodes[n.object_id] = n
76
- stack += adjacent(n, :direction => direction)
76
+ stack += adjacent(n, :direction => direction) if options[:recursive]
77
77
  end
78
78
  end
79
79
  nodes.values
80
80
  end
81
81
 
82
- def descendants(node)
82
+ def descendants(node, options = {:recursive => true})
83
83
  community(node, :out)
84
84
  end
85
85
 
86
- def ancestors(node)
86
+ def ancestors(node, options = {:recursive => true})
87
87
  community(node, :in)
88
88
  end
89
89
 
90
- def family(node)
90
+ def family(node, options = {:recursive => true})
91
91
  community(node, :all)
92
92
  end
93
93
  end
@@ -65,10 +65,11 @@ module Plexus
65
65
  def permutation?() comparability? and complement.comparability?; end
66
66
 
67
67
  # An undirected graph is defined to be split if there is a partition
68
- # V = S + K of its vertex set into a stable set S and a complete set K.
68
+ # V = S + K of its vertex set into a stable set S and a complete set K.
69
69
  def split?() triangulated? and complement.triangulated?; end
70
70
 
71
71
  private
72
+
72
73
  # Implementation taken from Golumbic's, "Algorithmic Graph Theory and
73
74
  # Perfect Graphs" pg. 99
74
75
  def triangulated_chromatic_number
@@ -85,6 +86,6 @@ module Plexus
85
86
  end; chi
86
87
  end
87
88
 
88
- end # UndirectedGraphAlgorithms
89
- end # UndirectedGraphBuilder
90
- end # Plexus
89
+ end
90
+ end
91
+ end
@@ -1,6 +1,6 @@
1
1
  module Plexus
2
2
  MAJOR = 0
3
3
  MINOR = 5
4
- PATCH = 8
4
+ PATCH = 10
5
5
  VERSION = [MAJOR, MINOR, PATCH].join('.')
6
6
  end
metadata CHANGED
@@ -1,188 +1,184 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: plexus
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.10
4
5
  prerelease:
5
- version: 0.5.8
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Bruce Williams
9
9
  - Jean-Denis Vauguet <jd@vauguet.fr>
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
-
14
- date: 2011-07-10 00:00:00 +02:00
15
- default_executable:
16
- dependencies:
17
- - !ruby/object:Gem::Dependency
18
- name: activesupport
19
- prerelease: false
20
- requirement: &id001 !ruby/object:Gem::Requirement
13
+ date: 2012-03-16 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rake
17
+ requirement: &17576720 !ruby/object:Gem::Requirement
21
18
  none: false
22
- requirements:
23
- - - ">="
24
- - !ruby/object:Gem::Version
25
- version: "0"
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
26
23
  type: :runtime
27
- version_requirements: *id001
28
- - !ruby/object:Gem::Dependency
29
- name: facets
30
24
  prerelease: false
31
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: *17576720
26
+ - !ruby/object:Gem::Dependency
27
+ name: activesupport
28
+ requirement: &17576160 !ruby/object:Gem::Requirement
32
29
  none: false
33
- requirements:
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: "0"
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
37
34
  type: :runtime
38
- version_requirements: *id002
39
- - !ruby/object:Gem::Dependency
40
- name: plexus
41
35
  prerelease: false
42
- requirement: &id003 !ruby/object:Gem::Requirement
36
+ version_requirements: *17576160
37
+ - !ruby/object:Gem::Dependency
38
+ name: facets
39
+ requirement: &17575040 !ruby/object:Gem::Requirement
43
40
  none: false
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: "0"
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
48
45
  type: :runtime
49
- version_requirements: *id003
50
- - !ruby/object:Gem::Dependency
51
- name: rspec
52
46
  prerelease: false
53
- requirement: &id004 !ruby/object:Gem::Requirement
47
+ version_requirements: *17575040
48
+ - !ruby/object:Gem::Dependency
49
+ name: rspec
50
+ requirement: &17574340 !ruby/object:Gem::Requirement
54
51
  none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- version: "0"
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
59
56
  type: :development
60
- version_requirements: *id004
61
- - !ruby/object:Gem::Dependency
62
- name: yard
63
57
  prerelease: false
64
- requirement: &id005 !ruby/object:Gem::Requirement
58
+ version_requirements: *17574340
59
+ - !ruby/object:Gem::Dependency
60
+ name: yard
61
+ requirement: &17573580 !ruby/object:Gem::Requirement
65
62
  none: false
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: "0"
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
70
67
  type: :development
71
- version_requirements: *id005
72
- description: |
73
- This library is based on GRATR and RGL.
74
-
68
+ prerelease: false
69
+ version_requirements: *17573580
70
+ description: ! 'This library is based on GRATR and RGL.
71
+
72
+
75
73
  Graph algorithms currently provided are:
76
-
74
+
75
+
77
76
  * Topological Sort
77
+
78
78
  * Strongly Connected Components
79
+
79
80
  * Transitive Closure
81
+
80
82
  * Rural Chinese Postman
83
+
81
84
  * Biconnected
82
85
 
86
+ '
83
87
  email: jd@vauguet.fr
84
88
  executables: []
85
-
86
89
  extensions: []
87
-
88
90
  extra_rdoc_files: []
89
-
90
- files:
91
- - lib/plexus/biconnected.rb
91
+ files:
92
+ - lib/plexus.rb
93
+ - lib/plexus/ext.rb
92
94
  - lib/plexus/arc.rb
95
+ - lib/plexus/maximum_flow.rb
96
+ - lib/plexus/biconnected.rb
93
97
  - lib/plexus/ruby_compatibility.rb
94
- - lib/plexus/dot.rb
95
- - lib/plexus/directed_graph.rb
96
- - lib/plexus/comparability.rb
97
- - lib/plexus/chinese_postman.rb
98
- - lib/plexus/classes/graph_classes.rb
99
- - lib/plexus/strong_components.rb
100
- - lib/plexus/support/support.rb
101
- - lib/plexus/common.rb
102
98
  - lib/plexus/search.rb
103
- - lib/plexus/arc_number.rb
104
- - lib/plexus/maximum_flow.rb
105
- - lib/plexus/ext.rb
106
- - lib/plexus/labels.rb
107
99
  - lib/plexus/undirected_graph.rb
108
100
  - lib/plexus/edge.rb
109
- - lib/plexus/directed_graph/distance.rb
110
- - lib/plexus/directed_graph/algorithms.rb
101
+ - lib/plexus/support/support.rb
102
+ - lib/plexus/labels.rb
111
103
  - lib/plexus/undirected_graph/algorithms.rb
104
+ - lib/plexus/arc_number.rb
105
+ - lib/plexus/directed_graph.rb
106
+ - lib/plexus/chinese_postman.rb
107
+ - lib/plexus/dot.rb
108
+ - lib/plexus/graph.rb
109
+ - lib/plexus/classes/graph_classes.rb
110
+ - lib/plexus/directed_graph/algorithms.rb
111
+ - lib/plexus/directed_graph/distance.rb
112
+ - lib/plexus/comparability.rb
113
+ - lib/plexus/strong_components.rb
112
114
  - lib/plexus/adjacency_graph.rb
115
+ - lib/plexus/common.rb
113
116
  - lib/plexus/version.rb
114
- - lib/plexus/graph.rb
115
- - lib/plexus.rb
116
- - vendor/priority-queue/ext/priority_queue/CPriorityQueue/priority_queue.c
117
- - vendor/priority-queue/ext/priority_queue/CPriorityQueue/extconf.rb
118
117
  - vendor/priority-queue/README
119
118
  - vendor/priority-queue/Makefile
119
+ - vendor/priority-queue/setup.rb
120
+ - vendor/priority-queue/CHANGELOG
121
+ - vendor/priority-queue/lib/priority_queue/ruby_priority_queue.rb
120
122
  - vendor/priority-queue/lib/priority_queue/c_priority_queue.rb
121
123
  - vendor/priority-queue/lib/priority_queue/poor_priority_queue.rb
122
- - vendor/priority-queue/lib/priority_queue/ruby_priority_queue.rb
123
124
  - vendor/priority-queue/lib/priority_queue.rb
124
125
  - vendor/priority-queue/benchmark/dijkstra.rb
125
- - vendor/priority-queue/CHANGELOG
126
+ - vendor/priority-queue/doc/c-vs-rb.png
126
127
  - vendor/priority-queue/doc/compare_big.gp
127
- - vendor/priority-queue/doc/compare_small.png
128
128
  - vendor/priority-queue/doc/compare_small.gp
129
- - vendor/priority-queue/doc/results.csv
130
- - vendor/priority-queue/doc/c-vs-rb.png
129
+ - vendor/priority-queue/doc/compare_small.png
131
130
  - vendor/priority-queue/doc/compare_big.png
131
+ - vendor/priority-queue/doc/results.csv
132
132
  - vendor/priority-queue/priority_queue.so
133
+ - vendor/priority-queue/ext/priority_queue/CPriorityQueue/extconf.rb
134
+ - vendor/priority-queue/ext/priority_queue/CPriorityQueue/priority_queue.c
133
135
  - vendor/priority-queue/test/priority_queue_test.rb
134
- - vendor/priority-queue/setup.rb
135
136
  - vendor/priority-queue/compare_comments.rb
136
137
  - vendor/rdot.rb
137
- - spec/spec.opts
138
+ - spec/undirected_graph_spec.rb
139
+ - spec/community_spec.rb
140
+ - spec/biconnected_spec.rb
141
+ - spec/strong_components_spec.rb
142
+ - spec/multi_edge_spec.rb
138
143
  - spec/edge_spec.rb
139
- - spec/inspection_spec.rb
140
- - spec/digraph_spec.rb
144
+ - spec/complement_spec.rb
145
+ - spec/digraph_distance_spec.rb
146
+ - spec/properties_spec.rb
141
147
  - spec/spec_helper.rb
142
148
  - spec/search_spec.rb
143
- - spec/triangulated_spec.rb
144
- - spec/multi_edge_spec.rb
145
- - spec/dot_spec.rb
146
149
  - spec/neighborhood_spec.rb
147
- - spec/complement_spec.rb
148
- - spec/biconnected_spec.rb
149
- - spec/undirected_graph_spec.rb
150
+ - spec/triangulated_spec.rb
151
+ - spec/spec.opts
150
152
  - spec/chinese_postman_spec.rb
151
- - spec/strong_components_spec.rb
152
- - spec/community_spec.rb
153
- - spec/digraph_distance_spec.rb
154
- - spec/properties_spec.rb
153
+ - spec/inspection_spec.rb
154
+ - spec/dot_spec.rb
155
+ - spec/digraph_spec.rb
155
156
  - Gemfile
156
157
  - LICENSE
157
158
  - Rakefile
158
159
  - README.md
159
- has_rdoc: true
160
160
  homepage: http://github.com/chikamichi/plexus
161
161
  licenses: []
162
-
163
162
  post_install_message:
164
163
  rdoc_options: []
165
-
166
- require_paths:
164
+ require_paths:
167
165
  - lib
168
- required_ruby_version: !ruby/object:Gem::Requirement
166
+ required_ruby_version: !ruby/object:Gem::Requirement
169
167
  none: false
170
- requirements:
171
- - - ">="
172
- - !ruby/object:Gem::Version
173
- version: "0"
174
- required_rubygems_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ! '>='
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
175
173
  none: false
176
- requirements:
177
- - - ">="
178
- - !ruby/object:Gem::Version
179
- version: "0"
174
+ requirements:
175
+ - - ! '>='
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
180
178
  requirements: []
181
-
182
179
  rubyforge_project:
183
- rubygems_version: 1.6.1
180
+ rubygems_version: 1.8.17
184
181
  signing_key:
185
182
  specification_version: 3
186
183
  summary: A framework for graph data structures and algorithms.
187
184
  test_files: []
188
-