molinillo 0.6.4 → 0.6.5

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: '09d18c88997aae5457b1aa36368b2a3134bf539e3d2972f268c536e06b4ca17e'
4
- data.tar.gz: 60a6c4950f21c00f7bc4e88499cacbb94374c7eea9e07c2cf52c012a4ba4e164
3
+ metadata.gz: 135680d0c4a7de58ac3e44505fa78ba73921c167a67f0772f5017ba6acb4c211
4
+ data.tar.gz: 41d3c7dde1f4925aa33cb534864a0d7d49c7372969db393f8e0c02410c9bd5a4
5
5
  SHA512:
6
- metadata.gz: 2ab70f2f47d6d2d89b4fdac53f61148135b3ff610997aa139e84110a5967d7838ac6b08ed4a9c3fe584aab6374a6451a857335239a509353c05de95525254fc5
7
- data.tar.gz: b3212b2b8dd7859fa2ef0a52751b4c5bd18a7c911dcaf0aa3695988bca193a8c7a11b4f80cf8c8ef2b427e3f4b70d88a83703f575ba1e5ef8df6b89313531085
6
+ metadata.gz: 7a81b3d5f68f54505f2ca431c302396a7e9d3d708e2ab51d4b9fd8c0eb8de7adce18de8e54738c3d49d3b4c4f2f5d03a791647369fb1fbd200537aac579b7fff
7
+ data.tar.gz: 3b2401002e64b4425d19f28f19b95d26ffa250eaa3dfc1ce1b2e7cdb8617aa799336bf8deee1f9e0c1f02f240b51133715d9500ca204319c693acd751c2ff91b
@@ -1,5 +1,17 @@
1
1
  # Molinillo Changelog
2
2
 
3
+ ## 0.6.5 (2018-03-22)
4
+
5
+ ##### Enhancements
6
+
7
+ * Improve performance of recursive vertex methods.
8
+ [Samuel Giddins](https://github.com/segiddins)
9
+
10
+ ##### Bug Fixes
11
+
12
+ * None.
13
+
14
+
3
15
  ## 0.6.4 (2017-10-29)
4
16
 
5
17
  ##### Enhancements
@@ -50,14 +50,25 @@ module Molinillo
50
50
  incoming_edges.map(&:origin)
51
51
  end
52
52
 
53
- # @return [Array<Vertex>] the vertices of {#graph} where `self` is a
53
+ # @return [Set<Vertex>] the vertices of {#graph} where `self` is a
54
54
  # {#descendent?}
55
55
  def recursive_predecessors
56
- vertices = predecessors
57
- vertices += Compatibility.flat_map(vertices, &:recursive_predecessors)
58
- vertices.uniq!
56
+ _recursive_predecessors
57
+ end
58
+
59
+ # @param [Set<Vertex>] vertices the set to add the predecessors to
60
+ # @return [Set<Vertex>] the vertices of {#graph} where `self` is a
61
+ # {#descendent?}
62
+ def _recursive_predecessors(vertices = Set.new)
63
+ incoming_edges.each do |edge|
64
+ vertex = edge.origin
65
+ next unless vertices.add?(vertex)
66
+ vertex._recursive_predecessors(vertices)
67
+ end
68
+
59
69
  vertices
60
70
  end
71
+ protected :_recursive_predecessors
61
72
 
62
73
  # @return [Array<Vertex>] the vertices of {#graph} that have an edge with
63
74
  # `self` as their {Edge#origin}
@@ -65,14 +76,25 @@ module Molinillo
65
76
  outgoing_edges.map(&:destination)
66
77
  end
67
78
 
68
- # @return [Array<Vertex>] the vertices of {#graph} where `self` is an
79
+ # @return [Set<Vertex>] the vertices of {#graph} where `self` is an
69
80
  # {#ancestor?}
70
81
  def recursive_successors
71
- vertices = successors
72
- vertices += Compatibility.flat_map(vertices, &:recursive_successors)
73
- vertices.uniq!
82
+ _recursive_successors
83
+ end
84
+
85
+ # @param [Set<Vertex>] vertices the set to add the successors to
86
+ # @return [Set<Vertex>] the vertices of {#graph} where `self` is an
87
+ # {#ancestor?}
88
+ def _recursive_successors(vertices = Set.new)
89
+ outgoing_edges.each do |edge|
90
+ vertex = edge.destination
91
+ next unless vertices.add?(vertex)
92
+ vertex._recursive_successors(vertices)
93
+ end
94
+
74
95
  vertices
75
96
  end
97
+ protected :_recursive_successors
76
98
 
77
99
  # @return [String] a string suitable for debugging
78
100
  def inspect
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Molinillo
4
4
  # The version of Molinillo.
5
- VERSION = '0.6.4'.freeze
5
+ VERSION = '0.6.5'.freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: molinillo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel E. Giddins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-29 00:00:00.000000000 Z
11
+ date: 2018-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  requirements: []
92
92
  rubyforge_project:
93
- rubygems_version: 2.6.13
93
+ rubygems_version: 2.7.6
94
94
  signing_key:
95
95
  specification_version: 4
96
96
  summary: Provides support for dependency resolution