tangle 0.4.2 → 0.5.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 +4 -4
- data/lib/tangle/directed/acyclic/edge.rb +20 -0
- data/lib/tangle/directed/acyclic/graph.rb +14 -0
- data/lib/tangle/errors.rb +8 -0
- data/lib/tangle.rb +8 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee78865b571dbfbc96822cb208d01eea82658dac5c553c8b25e3b991dc7e961b
|
4
|
+
data.tar.gz: a85db9accf74b1ef91b25fcf90362794edea78dae51509ffb02d6f522c86f59c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61859d678645444dc8529c23fda328348995867446b27016bdd18d6e08e4c2270af0f7eec1b77eb299c683d42a7ff711a50f3659822b5202a11416fa02ad5cc5
|
7
|
+
data.tar.gz: 2b0174a54065b6f9e13ad02edbe5da19870eb08de332c3bf0deaccf94a15428eeb81c458aafa0f379361d5099ac629fa57aaec9f77f7f50cc0e469a3d16232b8
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'tangle/directed/edge'
|
2
|
+
|
3
|
+
module Tangle
|
4
|
+
module Directed
|
5
|
+
module Acyclic
|
6
|
+
#
|
7
|
+
# An edge in a directed acyclic graph
|
8
|
+
#
|
9
|
+
class Edge < Tangle::Directed::Edge
|
10
|
+
private
|
11
|
+
|
12
|
+
def validate_edge
|
13
|
+
super
|
14
|
+
raise CyclicError if @parent.ancestor?(@child) ||
|
15
|
+
@child.descendant?(@parent)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'tangle/directed/graph'
|
2
|
+
require 'tangle/directed/acyclic/edge'
|
3
|
+
|
4
|
+
module Tangle
|
5
|
+
module Directed
|
6
|
+
module Acyclic
|
7
|
+
#
|
8
|
+
# A directed acyclic graph
|
9
|
+
class Graph < Tangle::Directed::Graph
|
10
|
+
Edge = Tangle::Directed::Acyclic::Edge
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/tangle/errors.rb
CHANGED
data/lib/tangle.rb
CHANGED
@@ -3,6 +3,7 @@ require 'tangle/errors'
|
|
3
3
|
require 'tangle/graph'
|
4
4
|
require 'tangle/simple/graph'
|
5
5
|
require 'tangle/directed/graph'
|
6
|
+
require 'tangle/directed/acyclic/graph'
|
6
7
|
|
7
8
|
# Tangle manages various types of graphs
|
8
9
|
#
|
@@ -12,8 +13,15 @@ require 'tangle/directed/graph'
|
|
12
13
|
# Tangle::SimpleGraph.new
|
13
14
|
# => Undirected graph with single edges between vertices, and no loops
|
14
15
|
#
|
16
|
+
# Tangle::DiGraph.new
|
17
|
+
# => Directed graph without edge constraints
|
18
|
+
#
|
19
|
+
# Tangle::DAG.new
|
20
|
+
# => Directed graph with no edge cycles
|
21
|
+
#
|
15
22
|
module Tangle
|
16
23
|
MultiGraph = Tangle::Graph
|
17
24
|
SimpleGraph = Tangle::Simple::Graph
|
18
25
|
DiGraph = Tangle::Directed::Graph
|
26
|
+
DAG = Tangle::Directed::Acyclic::Graph
|
19
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tangle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Calle Englund
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git-version-bump
|
@@ -99,6 +99,8 @@ files:
|
|
99
99
|
- bin/console
|
100
100
|
- bin/setup
|
101
101
|
- lib/tangle.rb
|
102
|
+
- lib/tangle/directed/acyclic/edge.rb
|
103
|
+
- lib/tangle/directed/acyclic/graph.rb
|
102
104
|
- lib/tangle/directed/edge.rb
|
103
105
|
- lib/tangle/directed/graph.rb
|
104
106
|
- lib/tangle/edge.rb
|