tsort 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: b225b5b2ce091e9f67eb7f57184fcf37eed0fac40303dd22ad5e2d5ff531f14d
4
- data.tar.gz: ede57295814f376dec4487c48015812c92105650df6c532efea26f6f597a157b
3
+ metadata.gz: fec6e698aaafb515cbb1d1d3da7c47f8a23d6962ea46b20beacaff24a602ebc5
4
+ data.tar.gz: 4360b342f4438c3407c8fc76085868626fcfc0a98df805edde686c57e287f5c8
5
5
  SHA512:
6
- metadata.gz: ecf41ba86a768b1b75bd1d1783a58f38050563757b7392cfb49c8070db0370d1ecd4116debf7adb8e2edd64ae2cf3e83dcc35a2274776bc3e8e9fdf665ee53e5
7
- data.tar.gz: e5edd26b1656672eb80ca3b9c88e83804d357779b6beddb448bf6a7357f314e2e99ba76f22b41a378ea48584de6d2a300d6dec4e4b3c6e964837b6a9a472d88f
6
+ metadata.gz: 3e2701ffd89ed3afd5a18683cc34018d985a3a6325b8d01d53dfc4d4d0da1bc50396a70d308ac808b89a2adb2838bd8273b92435e4132422ec214ea659e474ff
7
+ data.tar.gz: f70e00dcf6db0b210e6fe0dd98d70c2899edc25c5829482340f56a93091db53fe69ebc2c35103307837e1950d5c458cccba129b16e158e2ec9f998072ed31b15
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: 'github-actions'
4
+ directory: '/'
5
+ schedule:
6
+ interval: 'weekly'
@@ -11,14 +11,12 @@ jobs:
11
11
  os: [ ubuntu-latest, macos-latest ]
12
12
  runs-on: ${{ matrix.os }}
13
13
  steps:
14
- - uses: actions/checkout@master
14
+ - uses: actions/checkout@v3
15
15
  - name: Set up Ruby
16
16
  uses: ruby/setup-ruby@v1
17
17
  with:
18
18
  ruby-version: ${{ matrix.ruby }}
19
19
  - name: Install dependencies
20
- run: |
21
- gem install bundler --no-document
22
- bundle install
20
+ run: bundle install
23
21
  - name: Run test
24
22
  run: rake test
data/lib/tsort.rb CHANGED
@@ -172,8 +172,8 @@ module TSort
172
172
  # each_child = lambda {|n, &b| g[n].each(&b) }
173
173
  # p TSort.tsort(each_node, each_child) # raises TSort::Cyclic
174
174
  #
175
- def TSort.tsort(each_node, each_child)
176
- TSort.tsort_each(each_node, each_child).to_a
175
+ def self.tsort(each_node, each_child)
176
+ tsort_each(each_node, each_child).to_a
177
177
  end
178
178
 
179
179
  # The iterator version of the #tsort method.
@@ -220,10 +220,10 @@ module TSort
220
220
  # # 3
221
221
  # # 1
222
222
  #
223
- def TSort.tsort_each(each_node, each_child) # :yields: node
223
+ def self.tsort_each(each_node, each_child) # :yields: node
224
224
  return to_enum(__method__, each_node, each_child) unless block_given?
225
225
 
226
- TSort.each_strongly_connected_component(each_node, each_child) {|component|
226
+ each_strongly_connected_component(each_node, each_child) {|component|
227
227
  if component.size == 1
228
228
  yield component.first
229
229
  else
@@ -277,8 +277,8 @@ module TSort
277
277
  # p TSort.strongly_connected_components(each_node, each_child)
278
278
  # #=> [[4], [2, 3], [1]]
279
279
  #
280
- def TSort.strongly_connected_components(each_node, each_child)
281
- TSort.each_strongly_connected_component(each_node, each_child).to_a
280
+ def self.strongly_connected_components(each_node, each_child)
281
+ each_strongly_connected_component(each_node, each_child).to_a
282
282
  end
283
283
 
284
284
  # The iterator version of the #strongly_connected_components method.
@@ -339,14 +339,14 @@ module TSort
339
339
  # # [2, 3]
340
340
  # # [1]
341
341
  #
342
- def TSort.each_strongly_connected_component(each_node, each_child) # :yields: nodes
342
+ def self.each_strongly_connected_component(each_node, each_child) # :yields: nodes
343
343
  return to_enum(__method__, each_node, each_child) unless block_given?
344
344
 
345
345
  id_map = {}
346
346
  stack = []
347
347
  each_node.call {|node|
348
348
  unless id_map.include? node
349
- TSort.each_strongly_connected_component_from(node, each_child, id_map, stack) {|c|
349
+ each_strongly_connected_component_from(node, each_child, id_map, stack) {|c|
350
350
  yield c
351
351
  }
352
352
  end
@@ -405,7 +405,7 @@ module TSort
405
405
  # # [2, 3]
406
406
  # # [1]
407
407
  #
408
- def TSort.each_strongly_connected_component_from(node, each_child, id_map={}, stack=[]) # :yields: nodes
408
+ def self.each_strongly_connected_component_from(node, each_child, id_map={}, stack=[]) # :yields: nodes
409
409
  return to_enum(__method__, node, each_child, id_map, stack) unless block_given?
410
410
 
411
411
  minimum_id = node_id = id_map[node] = id_map.size
@@ -418,7 +418,7 @@ module TSort
418
418
  minimum_id = child_id if child_id && child_id < minimum_id
419
419
  else
420
420
  sub_minimum_id =
421
- TSort.each_strongly_connected_component_from(child, each_child, id_map, stack) {|c|
421
+ each_strongly_connected_component_from(child, each_child, id_map, stack) {|c|
422
422
  yield c
423
423
  }
424
424
  minimum_id = sub_minimum_id if sub_minimum_id < minimum_id
data/tsort.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "tsort"
3
- spec.version = "0.1.0"
3
+ spec.version = "0.1.1"
4
4
  spec.authors = ["Tanaka Akira"]
5
5
  spec.email = ["akr@fsij.org"]
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tsort
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanaka Akira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-18 00:00:00.000000000 Z
11
+ date: 2022-12-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Topological sorting using Tarjan's algorithm
14
14
  email:
@@ -17,6 +17,7 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - ".github/dependabot.yml"
20
21
  - ".github/workflows/test.yml"
21
22
  - ".gitignore"
22
23
  - Gemfile
@@ -49,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
50
  - !ruby/object:Gem::Version
50
51
  version: '0'
51
52
  requirements: []
52
- rubygems_version: 3.2.0.rc.1
53
+ rubygems_version: 3.4.0.dev
53
54
  signing_key:
54
55
  specification_version: 4
55
56
  summary: Topological sorting using Tarjan's algorithm