tangle 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tangle/directed/acyclic/edge.rb +1 -1
- data/lib/tangle/mixin/ancestry.rb +2 -2
- data/lib/tangle/mixin/connectedness.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49f9618a6db24308eea9b672789ec0cb9a75ec124050cc5b748340bbc19ccdea
|
4
|
+
data.tar.gz: bb5aa5bf4b8e80942c7b2f1871529ef39a2a871ded60a01fb4acf23a288bca41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47dddb4a4fa185863f69e06b63526eaa197d4f6bbdd7c5185199f6890eaa10f5799d9137868e7632bf6b1e8fd74c79fea3a066d728ebf0270f91914cd9f81254
|
7
|
+
data.tar.gz: 2c423486fb396bd060acb919fe00ac4459b7119a0fe08790549300560e39ea8831fb6df792dc5006d9733b085d9eb0ef9d1b957645aaa21cf4b0acfab2dc85a6
|
@@ -40,7 +40,7 @@ module Tangle
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def ancestor?(other)
|
43
|
-
|
43
|
+
other == self || parents.any? { |parent| parent.ancestor?(other) }
|
44
44
|
end
|
45
45
|
|
46
46
|
def child_edges
|
@@ -56,7 +56,7 @@ module Tangle
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def descendant?(other)
|
59
|
-
|
59
|
+
other == self || children.any? { |child| child.descendant?(other) }
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
@@ -53,20 +53,20 @@ module Tangle
|
|
53
53
|
# Two vertices are connected if there is a path between them,
|
54
54
|
# and a vertex is connected to itself.
|
55
55
|
#
|
56
|
-
def connected?(other
|
56
|
+
def connected?(other)
|
57
57
|
raise GraphError unless @graph == other.graph
|
58
58
|
return true if self == other
|
59
59
|
|
60
|
-
connected_excluding?(other,
|
60
|
+
connected_excluding?(other, Set[self])
|
61
61
|
end
|
62
62
|
|
63
63
|
protected
|
64
64
|
|
65
|
-
def connected_excluding?(other,
|
66
|
-
return true if
|
65
|
+
def connected_excluding?(other, history)
|
66
|
+
return true if other.adjacent?(self)
|
67
67
|
|
68
68
|
(neighbours - history).any? do |vertex|
|
69
|
-
vertex.connected_excluding?(other,
|
69
|
+
vertex.connected_excluding?(other, history << self)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|