graph_matching 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bacfa88152804ed21ffa7b44a218a80cf56b8c65
4
- data.tar.gz: 03acf6fa8396047dbc5fa340c20411a6292b336c
3
+ metadata.gz: 9fb85654523ce9fe2560a9973b2371062627116e
4
+ data.tar.gz: 73dcf437cc9eeef96045c5d0a3a7ff9213f4e7bc
5
5
  SHA512:
6
- metadata.gz: 9eaaddb694d7e2510664e4aea19d54795aa7eb059281221ea4baf76c71bc5334e7a8477bf5801a3d2938b5f16953a9ff75e3c1c3d9389bd787f7211efc476a26
7
- data.tar.gz: 80e2c32d279e3ea1105c44ea07c3b5e92a445f1d5517c8d7485d54bee42ba021fc0cd114f00a79b4ab969c3f6812745def3130828722d75466f8fd88b2e848c3
6
+ metadata.gz: 5ac775ea72a05fc3ab61b046f81e0b5e7cd24e3a7cfb58b7d3481351a0bc8ee3a3c3bd73457520cfc7d4c18b093698a86eead01783e46538ef4c50e97ef7bea4
7
+ data.tar.gz: 164e1863a6460a46fbb844463618e1ee1a1c95e20a830765fd6c590d68d6f4cdf034a5df3553060cebea63fdcc36a5e02aa515a6ca3ed58a40d3bcd077a371d2
data/.rubocop.yml CHANGED
@@ -1,7 +1,10 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.0
4
+ TargetRubyVersion: 2.3
5
+
6
+ Layout/MultilineOperationIndentation:
7
+ EnforcedStyle: indented
5
8
 
6
9
  # Not useful compared to metrics like AbcSize
7
10
  Metrics/BlockLength:
@@ -20,9 +23,6 @@ Metrics/MethodLength:
20
23
  Style/IfUnlessModifier:
21
24
  Enabled: false
22
25
 
23
- Style/MultilineOperationIndentation:
24
- EnforcedStyle: indented
25
-
26
26
  # For this project, where performance matters, do not use the nil predicate method
27
27
  # (`nil?`), as it is slower than the `==` operator.
28
28
  Style/NilComparison:
data/.rubocop_todo.yml CHANGED
@@ -1,40 +1,137 @@
1
- # Remove these configuration records
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config --exclude-limit 50 --no-offense-counts --no-auto-gen-timestamp`
3
+ # using RuboCop version 0.64.0.
4
+ # The point is for the user to remove these configuration records
2
5
  # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Cop supports --auto-correct.
10
+ Layout/CommentIndentation:
11
+ Exclude:
12
+ - 'lib/graph_matching/algorithm/mcm_general.rb'
13
+
14
+ # Cop supports --auto-correct.
15
+ Layout/EmptyLineAfterGuardClause:
16
+ Exclude:
17
+ - 'benchmark/mwm_general/incomplete_graphs/benchmark.rb'
18
+ - 'lib/graph_matching/algorithm/mcm_bipartite.rb'
19
+ - 'lib/graph_matching/algorithm/mcm_general.rb'
20
+ - 'lib/graph_matching/algorithm/mwm_bipartite.rb'
21
+ - 'lib/graph_matching/algorithm/mwm_general.rb'
22
+ - 'lib/graph_matching/algorithm/mwmg_delta_assertions.rb'
23
+ - 'lib/graph_matching/core_ext/set.rb'
24
+ - 'lib/graph_matching/graph/bigraph.rb'
25
+ - 'lib/graph_matching/graph/graph.rb'
26
+ - 'lib/graph_matching/graph/weighted.rb'
27
+ - 'lib/graph_matching/integer_vertexes.rb'
28
+ - 'lib/graph_matching/matching.rb'
29
+ - 'lib/graph_matching/visualize.rb'
30
+ - 'spec/spec_helper.rb'
31
+
32
+ # Cop supports --auto-correct.
33
+ Layout/EmptyLineAfterMagicComment:
34
+ Exclude:
35
+ - 'graph_matching.gemspec'
36
+
37
+ # Cop supports --auto-correct.
38
+ # Configuration parameters: EnforcedStyle.
39
+ # SupportedStyles: empty_lines, no_empty_lines
40
+ Layout/EmptyLinesAroundBlockBody:
41
+ Exclude:
42
+ - 'lib/graph_matching/algorithm/mcm_general.rb'
43
+
44
+ # Cop supports --auto-correct.
45
+ # Configuration parameters: EnforcedStyle.
46
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
47
+ Layout/EmptyLinesAroundClassBody:
48
+ Exclude:
49
+ - 'lib/graph_matching/algorithm/mcm_bipartite.rb'
50
+ - 'lib/graph_matching/algorithm/mcm_general.rb'
51
+ - 'lib/graph_matching/algorithm/mwm_bipartite.rb'
52
+ - 'lib/graph_matching/algorithm/mwm_general.rb'
53
+
54
+ # Cop supports --auto-correct.
55
+ Layout/EmptyLinesAroundMethodBody:
56
+ Exclude:
57
+ - 'lib/graph_matching/algorithm/mcm_general.rb'
58
+
59
+ # Cop supports --auto-correct.
60
+ # Configuration parameters: EnforcedStyle.
61
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
62
+ Layout/EmptyLinesAroundModuleBody:
63
+ Exclude:
64
+ - 'lib/graph_matching/algorithm/matching_algorithm.rb'
65
+ - 'lib/graph_matching/algorithm/mcm_bipartite.rb'
66
+ - 'lib/graph_matching/algorithm/mcm_general.rb'
67
+ - 'lib/graph_matching/algorithm/mwm_bipartite.rb'
68
+ - 'lib/graph_matching/algorithm/mwm_general.rb'
69
+
70
+ # Cop supports --auto-correct.
71
+ # Configuration parameters: EnforcedStyle.
72
+ # SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
73
+ Layout/IndentHeredoc:
74
+ Exclude:
75
+ - 'lib/graph_matching/errors.rb'
3
76
 
4
- # Offense count: 24
5
77
  Metrics/AbcSize:
6
- Max: 75
78
+ Max: 74
7
79
 
8
- # Offense count: 8
9
80
  Metrics/CyclomaticComplexity:
10
81
  Max: 17
11
82
 
12
- # Offense count: 1
13
83
  # Configuration parameters: CountKeywordArgs.
14
84
  Metrics/ParameterLists:
15
85
  Max: 7
16
86
 
17
- # Offense count: 7
18
87
  Metrics/PerceivedComplexity:
19
88
  Max: 17
20
89
 
21
- # Offense count: 1
90
+ # Configuration parameters: Blacklist.
91
+ # Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
92
+ Naming/HeredocDelimiterNaming:
93
+ Exclude:
94
+ - 'graph_matching.gemspec'
95
+ - 'lib/graph_matching/algorithm/mwm_general.rb'
96
+ - 'lib/graph_matching/errors.rb'
97
+
98
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
99
+ # AllowedNames: io, id, to, by, on, in, at, ip, db
100
+ Naming/UncommunicativeMethodParamName:
101
+ Exclude:
102
+ - 'benchmark/mcm_bipartite/complete_bigraphs/benchmark.rb'
103
+ - 'benchmark/mcm_general/complete_graphs/benchmark.rb'
104
+ - 'benchmark/mwm_bipartite/complete_bigraphs/benchmark.rb'
105
+ - 'benchmark/mwm_general/complete_graphs/benchmark.rb'
106
+ - 'benchmark/mwm_general/incomplete_graphs/benchmark.rb'
107
+ - 'lib/graph_matching/algorithm/mcm_bipartite.rb'
108
+ - 'lib/graph_matching/algorithm/mcm_general.rb'
109
+ - 'lib/graph_matching/algorithm/mwm_bipartite.rb'
110
+ - 'lib/graph_matching/algorithm/mwm_general.rb'
111
+ - 'lib/graph_matching/directed_edge_set.rb'
112
+ - 'lib/graph_matching/graph/graph.rb'
113
+ - 'lib/graph_matching/graph/weighted.rb'
114
+ - 'lib/graph_matching/matching.rb'
115
+ - 'lib/graph_matching/ordered_set.rb'
116
+ - 'lib/graph_matching/visualize.rb'
117
+ - 'profile/mwm_general/profile.rb'
118
+ - 'spec/graph_matching/algorithm/mcm_general_spec.rb'
119
+
22
120
  # Cop supports --auto-correct.
23
- # Configuration parameters: EnforcedStyle, SupportedStyles.
121
+ # Configuration parameters: EnforcedStyle.
24
122
  # SupportedStyles: prefer_alias, prefer_alias_method
25
123
  Style/Alias:
26
124
  Exclude:
27
125
  - 'lib/graph_matching/ordered_set.rb'
28
126
 
29
- # Offense count: 4
127
+ # Configuration parameters: AllowedChars.
30
128
  Style/AsciiComments:
31
129
  Exclude:
32
130
  - 'lib/graph_matching/algorithm/mwm_bipartite.rb'
33
131
  - 'lib/graph_matching/algorithm/mwm_general.rb'
34
132
 
35
- # Offense count: 18
36
133
  # Cop supports --auto-correct.
37
- # Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
134
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods.
38
135
  # SupportedStyles: line_count_based, semantic, braces_for_chaining
39
136
  # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
40
137
  # FunctionalMethods: let, let!, subject, watch
@@ -50,73 +147,76 @@ Style/BlockDelimiters:
50
147
  - 'lib/graph_matching/ordered_set.rb'
51
148
  - 'spec/graph_matching/algorithm/mcm_bipartite_spec.rb'
52
149
 
53
- # Offense count: 7
54
- # Cop supports --auto-correct.
55
- Style/CommentIndentation:
150
+ Style/CommentedKeyword:
56
151
  Exclude:
57
152
  - 'lib/graph_matching/algorithm/mcm_general.rb'
58
153
 
59
- # Offense count: 1
60
154
  # Cop supports --auto-correct.
61
- # Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly, IncludeTernaryExpressions.
155
+ # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
62
156
  # SupportedStyles: assign_to_condition, assign_inside_condition
63
157
  Style/ConditionalAssignment:
64
158
  Exclude:
65
159
  - 'lib/graph_matching/algorithm/mwm_general.rb'
66
160
 
67
- # Offense count: 2
68
161
  # Cop supports --auto-correct.
69
- # Configuration parameters: EnforcedStyle, SupportedStyles.
162
+ # Configuration parameters: EnforcedStyle.
70
163
  # SupportedStyles: empty, nil, both
71
164
  Style/EmptyElse:
72
165
  Exclude:
73
166
  - 'lib/graph_matching/algorithm/mwm_general.rb'
74
167
 
75
- # Offense count: 1
76
168
  # Cop supports --auto-correct.
77
- Style/EmptyLineAfterMagicComment:
169
+ Style/Encoding:
78
170
  Exclude:
171
+ - 'benchmark/mcm_bipartite/complete_bigraphs/benchmark.rb'
172
+ - 'benchmark/mcm_general/complete_graphs/benchmark.rb'
173
+ - 'benchmark/mwm_bipartite/complete_bigraphs/benchmark.rb'
174
+ - 'benchmark/mwm_bipartite/misc/calc_d2/benchmark.rb'
175
+ - 'benchmark/mwm_general/complete_graphs/benchmark.rb'
176
+ - 'benchmark/mwm_general/incomplete_graphs/benchmark.rb'
79
177
  - 'graph_matching.gemspec'
80
-
81
- # Offense count: 3
82
- # Cop supports --auto-correct.
83
- # Configuration parameters: EnforcedStyle, SupportedStyles.
84
- # SupportedStyles: empty_lines, no_empty_lines
85
- Style/EmptyLinesAroundBlockBody:
86
- Exclude:
87
- - 'lib/graph_matching/algorithm/mcm_general.rb'
88
-
89
- # Offense count: 6
90
- # Cop supports --auto-correct.
91
- # Configuration parameters: EnforcedStyle, SupportedStyles.
92
- # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
93
- Style/EmptyLinesAroundClassBody:
94
- Exclude:
178
+ - 'lib/graph_matching.rb'
179
+ - 'lib/graph_matching/algorithm/matching_algorithm.rb'
95
180
  - 'lib/graph_matching/algorithm/mcm_bipartite.rb'
96
181
  - 'lib/graph_matching/algorithm/mcm_general.rb'
97
182
  - 'lib/graph_matching/algorithm/mwm_bipartite.rb'
98
183
  - 'lib/graph_matching/algorithm/mwm_general.rb'
184
+ - 'lib/graph_matching/assertion.rb'
185
+ - 'lib/graph_matching/core_ext/set.rb'
186
+ - 'lib/graph_matching/directed_edge_set.rb'
187
+ - 'lib/graph_matching/errors.rb'
188
+ - 'lib/graph_matching/graph/bigraph.rb'
189
+ - 'lib/graph_matching/graph/graph.rb'
190
+ - 'lib/graph_matching/graph/weighted.rb'
191
+ - 'lib/graph_matching/graph/weighted_bigraph.rb'
192
+ - 'lib/graph_matching/graph/weighted_graph.rb'
193
+ - 'lib/graph_matching/integer_vertexes.rb'
194
+ - 'lib/graph_matching/matching.rb'
195
+ - 'lib/graph_matching/ordered_set.rb'
196
+ - 'lib/graph_matching/version.rb'
197
+ - 'lib/graph_matching/visualize.rb'
198
+ - 'spec/graph_matching/algorithm/matching_algorithm_spec.rb'
199
+ - 'spec/graph_matching/algorithm/mcm_bipartite_spec.rb'
200
+ - 'spec/graph_matching/algorithm/mcm_general_spec.rb'
201
+ - 'spec/graph_matching/algorithm/mwm_bipartite_spec.rb'
202
+ - 'spec/graph_matching/algorithm/mwm_general_spec.rb'
203
+ - 'spec/graph_matching/graph/bigraph_spec.rb'
204
+ - 'spec/graph_matching/graph/graph_spec.rb'
205
+ - 'spec/graph_matching/graph/weighted_spec.rb'
206
+ - 'spec/graph_matching/integer_vertexes_spec.rb'
207
+ - 'spec/graph_matching/matching_spec.rb'
208
+ - 'spec/graph_matching/visualize_spec.rb'
209
+ - 'spec/graph_matching_spec.rb'
210
+ - 'spec/spec_helper.rb'
99
211
 
100
- # Offense count: 2
101
212
  # Cop supports --auto-correct.
102
- Style/EmptyLinesAroundMethodBody:
213
+ Style/ExpandPathArguments:
103
214
  Exclude:
104
- - 'lib/graph_matching/algorithm/mcm_general.rb'
215
+ - 'graph_matching.gemspec'
216
+ - 'spec/spec_helper.rb'
105
217
 
106
- # Offense count: 7
107
218
  # Cop supports --auto-correct.
108
- # Configuration parameters: EnforcedStyle, SupportedStyles.
109
- # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
110
- Style/EmptyLinesAroundModuleBody:
111
- Exclude:
112
- - 'lib/graph_matching/algorithm/matching_algorithm.rb'
113
- - 'lib/graph_matching/algorithm/mcm_bipartite.rb'
114
- - 'lib/graph_matching/algorithm/mcm_general.rb'
115
- - 'lib/graph_matching/algorithm/mwm_bipartite.rb'
116
- - 'lib/graph_matching/algorithm/mwm_general.rb'
117
-
118
- # Offense count: 5
119
- # Configuration parameters: EnforcedStyle, SupportedStyles.
219
+ # Configuration parameters: EnforcedStyle.
120
220
  # SupportedStyles: format, sprintf, percent
121
221
  Style/FormatString:
122
222
  Exclude:
@@ -126,7 +226,56 @@ Style/FormatString:
126
226
  - 'benchmark/mwm_general/complete_graphs/benchmark.rb'
127
227
  - 'benchmark/mwm_general/incomplete_graphs/benchmark.rb'
128
228
 
129
- # Offense count: 16
229
+ # Cop supports --auto-correct.
230
+ # Configuration parameters: EnforcedStyle.
231
+ # SupportedStyles: when_needed, always, never
232
+ Style/FrozenStringLiteralComment:
233
+ Exclude:
234
+ - 'Gemfile'
235
+ - 'Rakefile'
236
+ - 'benchmark/mcm_bipartite/complete_bigraphs/benchmark.rb'
237
+ - 'benchmark/mcm_general/complete_graphs/benchmark.rb'
238
+ - 'benchmark/mwm_bipartite/complete_bigraphs/benchmark.rb'
239
+ - 'benchmark/mwm_bipartite/misc/calc_d2/benchmark.rb'
240
+ - 'benchmark/mwm_general/complete_graphs/benchmark.rb'
241
+ - 'benchmark/mwm_general/incomplete_graphs/benchmark.rb'
242
+ - 'graph_matching.gemspec'
243
+ - 'lib/graph_matching.rb'
244
+ - 'lib/graph_matching/algorithm/matching_algorithm.rb'
245
+ - 'lib/graph_matching/algorithm/mcm_bipartite.rb'
246
+ - 'lib/graph_matching/algorithm/mcm_general.rb'
247
+ - 'lib/graph_matching/algorithm/mwm_bipartite.rb'
248
+ - 'lib/graph_matching/algorithm/mwm_general.rb'
249
+ - 'lib/graph_matching/algorithm/mwmg_delta_assertions.rb'
250
+ - 'lib/graph_matching/assertion.rb'
251
+ - 'lib/graph_matching/core_ext/set.rb'
252
+ - 'lib/graph_matching/directed_edge_set.rb'
253
+ - 'lib/graph_matching/errors.rb'
254
+ - 'lib/graph_matching/graph/bigraph.rb'
255
+ - 'lib/graph_matching/graph/graph.rb'
256
+ - 'lib/graph_matching/graph/weighted.rb'
257
+ - 'lib/graph_matching/graph/weighted_bigraph.rb'
258
+ - 'lib/graph_matching/graph/weighted_graph.rb'
259
+ - 'lib/graph_matching/integer_vertexes.rb'
260
+ - 'lib/graph_matching/matching.rb'
261
+ - 'lib/graph_matching/ordered_set.rb'
262
+ - 'lib/graph_matching/version.rb'
263
+ - 'lib/graph_matching/visualize.rb'
264
+ - 'profile/mwm_general/profile.rb'
265
+ - 'spec/graph_matching/algorithm/matching_algorithm_spec.rb'
266
+ - 'spec/graph_matching/algorithm/mcm_bipartite_spec.rb'
267
+ - 'spec/graph_matching/algorithm/mcm_general_spec.rb'
268
+ - 'spec/graph_matching/algorithm/mwm_bipartite_spec.rb'
269
+ - 'spec/graph_matching/algorithm/mwm_general_spec.rb'
270
+ - 'spec/graph_matching/graph/bigraph_spec.rb'
271
+ - 'spec/graph_matching/graph/graph_spec.rb'
272
+ - 'spec/graph_matching/graph/weighted_spec.rb'
273
+ - 'spec/graph_matching/integer_vertexes_spec.rb'
274
+ - 'spec/graph_matching/matching_spec.rb'
275
+ - 'spec/graph_matching/visualize_spec.rb'
276
+ - 'spec/graph_matching_spec.rb'
277
+ - 'spec/spec_helper.rb'
278
+
130
279
  # Configuration parameters: MinBodyLength.
131
280
  Style/GuardClause:
132
281
  Exclude:
@@ -137,15 +286,10 @@ Style/GuardClause:
137
286
  - 'lib/graph_matching/algorithm/mwmg_delta_assertions.rb'
138
287
  - 'lib/graph_matching/assertion.rb'
139
288
 
140
- # Offense count: 1
141
- # Cop supports --auto-correct.
142
- # Configuration parameters: EnforcedStyle, SupportedStyles.
143
- # SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
144
- Style/IndentHeredoc:
289
+ Style/MultipleComparison:
145
290
  Exclude:
146
- - 'lib/graph_matching/errors.rb'
291
+ - 'lib/graph_matching/algorithm/mwmg_delta_assertions.rb'
147
292
 
148
- # Offense count: 2
149
293
  # Cop supports --auto-correct.
150
294
  # Configuration parameters: PreferredDelimiters.
151
295
  Style/PercentLiteralDelimiters:
@@ -153,9 +297,13 @@ Style/PercentLiteralDelimiters:
153
297
  - 'lib/graph_matching/algorithm/mwm_general.rb'
154
298
  - 'spec/graph_matching/integer_vertexes_spec.rb'
155
299
 
156
- # Offense count: 1
157
300
  # Cop supports --auto-correct.
158
- # Configuration parameters: SupportedStyles.
301
+ Style/StderrPuts:
302
+ Exclude:
303
+ - 'lib/graph_matching/visualize.rb'
304
+
305
+ # Cop supports --auto-correct.
306
+ # Configuration parameters: MinSize.
159
307
  # SupportedStyles: percent, brackets
160
308
  Style/SymbolArray:
161
309
  EnforcedStyle: brackets
data/.travis.yml CHANGED
@@ -1,8 +1,9 @@
1
+ cache: bundler
1
2
  language: ruby
2
- rvm:
3
- - "2.0.0-p648"
4
- - "2.1.10"
5
- - "2.2.5"
6
- - "2.3.1"
7
3
  notifications:
8
4
  email: false
5
+ rvm:
6
+ - "2.3.8"
7
+ - "2.4.5"
8
+ - "2.5.3"
9
+ - "2.6.1"
data/CHANGELOG.md CHANGED
@@ -3,11 +3,25 @@
3
3
  This project follows [semver 2.0.0][1] and the recommendations
4
4
  of [keepachangelog.com][2].
5
5
 
6
+ ## Unreleased
7
+
8
+ ## 0.2.0 (2019-02-15)
9
+
10
+ ### Breaking Changes
11
+
12
+ - Drop support for ruby < 2.3
13
+ - Removed `GraphMatching::VERSION`, use `GraphMatching.gem_version` instead
14
+
15
+ ### Fixed
16
+
17
+ - [#7](https://github.com/jaredbeck/graph_matching/pull/7) -
18
+ An edge can be any `Numeric`
19
+
6
20
  ## 0.1.1 (2017-05-10)
7
21
 
8
22
  ### Fixed
9
23
 
10
- - Reduce size of gem by omitting unnecessary files
24
+ - Reduce size of gem from 9 MB to 32 kb by omitting unnecessary files
11
25
 
12
26
  ## 0.1.0 (2017-05-10)
13
27
 
data/README.md CHANGED
@@ -64,7 +64,7 @@ and Galil (1986), which performs in O(n ^ (3/4) m log N).
64
64
 
65
65
  ```ruby
66
66
  require 'graph_matching'
67
- g = GraphMatching::Graph::WeightedGraph[
67
+ g = GraphMatching::Graph::WeightedBigraph[
68
68
  [1, 2, 10],
69
69
  [1, 3, 11]
70
70
  ]
@@ -94,13 +94,20 @@ will be considered.
94
94
  require 'graph_matching'
95
95
  g = GraphMatching::Graph::WeightedGraph[
96
96
  [1, 2, 10],
97
- [1, 3, 11]
97
+ [2, 3, 21],
98
+ [3, 4, 10]
98
99
  ]
99
100
  m = g.maximum_weighted_matching(false)
100
101
  m.edges
101
- #=> [[3, 1]]
102
+ #=> [[3, 2]]
102
103
  m.weight(g)
103
- #=> 11
104
+ #=> 21
105
+
106
+ m = g.maximum_weighted_matching(true)
107
+ m.edges
108
+ #=> [[2, 1], [4, 3]]
109
+ m.weight(g)
110
+ #=> 20
104
111
  ```
105
112
 
106
113
  The algorithm performs in O(mn log n) as described by
@@ -5,7 +5,7 @@ require 'graph_matching/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'graph_matching'
8
- spec.version = GraphMatching::VERSION
8
+ spec.version = GraphMatching.gem_version.to_s
9
9
  spec.authors = ['Jared Beck']
10
10
  spec.email = ['jared@jaredbeck.com']
11
11
  spec.summary = 'Finds maximum matchings in undirected graphs.'
@@ -21,13 +21,13 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
22
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
23
  spec.require_paths = ['lib']
24
- spec.required_ruby_version = '>= 2.2.0'
24
+ spec.required_ruby_version = '>= 2.3.0'
25
25
  spec.add_runtime_dependency 'rgl', '~> 0.5.0'
26
26
  spec.add_development_dependency 'bundler', '~> 1.12'
27
27
  spec.add_development_dependency 'pry-byebug', '~> 3.4'
28
+ spec.add_development_dependency 'rake', '~> 12.0'
28
29
  spec.add_development_dependency 'rspec-core', '~> 3.6'
29
30
  spec.add_development_dependency 'rspec-expectations', '~> 3.6'
30
31
  spec.add_development_dependency 'rspec-mocks', '~> 3.6'
31
- spec.add_development_dependency 'rake', '~> 12.0'
32
- spec.add_development_dependency 'rubocop', '~> 0.48.1'
32
+ spec.add_development_dependency 'rubocop', '~> 0.64.0'
33
33
  end
@@ -24,13 +24,13 @@ module GraphMatching
24
24
  end
25
25
  end
26
26
 
27
- # rubocop:disable Style/PredicateName
27
+ # rubocop:disable Naming/PredicateName
28
28
  def is_a(klass)
29
29
  unless obj.is_a?(klass)
30
30
  raise TypeError, "Expected #{klass}, got #{obj.class}"
31
31
  end
32
32
  end
33
- # rubocop:enable Style/PredicateName
33
+ # rubocop:enable Naming/PredicateName
34
34
 
35
35
  def not_nil
36
36
  if obj.nil?
@@ -68,7 +68,7 @@ module GraphMatching
68
68
  e.is_a?(Array) &&
69
69
  e.length == 3 &&
70
70
  e[0, 2].all? { |i| i.is_a?(Integer) } &&
71
- e[2].is_a?(Integer) || e[2].is_a?(Float)
71
+ e[2].is_a?(Numeric)
72
72
  end
73
73
  end
74
74
 
@@ -2,9 +2,7 @@
2
2
 
3
3
  # no-doc
4
4
  module GraphMatching
5
- VERSION = '0.1.1'.freeze
6
-
7
5
  def self.gem_version
8
- ::Gem::Version.new(VERSION)
6
+ ::Gem::Version.new('0.2.0')
9
7
  end
10
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graph_matching
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Beck
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-10 00:00:00.000000000 Z
11
+ date: 2019-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rgl
@@ -53,21 +53,21 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.4'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec-core
56
+ name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.6'
61
+ version: '12.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.6'
68
+ version: '12.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rspec-expectations
70
+ name: rspec-core
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.6'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rspec-mocks
84
+ name: rspec-expectations
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
@@ -95,33 +95,33 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.6'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rake
98
+ name: rspec-mocks
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '12.0'
103
+ version: '3.6'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '12.0'
110
+ version: '3.6'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rubocop
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.48.1
117
+ version: 0.64.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.48.1
124
+ version: 0.64.0
125
125
  description: |2
126
126
  Efficient algorithms for maximum cardinality
127
127
  and weighted matchings in undirected graphs.
@@ -174,7 +174,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
174
174
  requirements:
175
175
  - - ">="
176
176
  - !ruby/object:Gem::Version
177
- version: 2.2.0
177
+ version: 2.3.0
178
178
  required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  requirements:
180
180
  - - ">="
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  version: '0'
183
183
  requirements: []
184
184
  rubyforge_project:
185
- rubygems_version: 2.6.12
185
+ rubygems_version: 2.5.2.3
186
186
  signing_key:
187
187
  specification_version: 4
188
188
  summary: Finds maximum matchings in undirected graphs.