yargi 0.1.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.
@@ -0,0 +1,38 @@
1
+ digraph G {
2
+ graph[]
3
+ V0 [label=""shape="diamond"fixedsize="true"width="0.5"]
4
+ V1 [label=""shape="diamond"fixedsize="true"width="0.5"]
5
+ V2 [label=""shape="diamond"fixedsize="true"width="0.5"]
6
+ V3 [label=""shape="diamond"fixedsize="true"width="0.5"]
7
+ V4 [label=""shape="diamond"fixedsize="true"width="0.5"]
8
+ V5 [label=""shape="doublecircle"fixedsize="true"width="0.5"]
9
+ V6 [label=""shape="doublecircle"fixedsize="true"width="0.5"]
10
+ V7 [label=""shape="doublecircle"fixedsize="true"width="0.5"]
11
+ V8 [label=""shape="doublecircle"fixedsize="true"width="0.5"]
12
+ V9 [label=""shape="doublecircle"fixedsize="true"width="0.5"]
13
+ V0 -> V5 [label="from 0 to 5"]
14
+ V0 -> V6 [label="from 0 to 6"]
15
+ V0 -> V7 [label="from 0 to 7"]
16
+ V0 -> V8 [label="from 0 to 8"]
17
+ V0 -> V9 [label="from 0 to 9"]
18
+ V1 -> V5 [label="from 1 to 5"]
19
+ V1 -> V6 [label="from 1 to 6"]
20
+ V1 -> V7 [label="from 1 to 7"]
21
+ V1 -> V8 [label="from 1 to 8"]
22
+ V1 -> V9 [label="from 1 to 9"]
23
+ V2 -> V5 [label="from 2 to 5"]
24
+ V2 -> V6 [label="from 2 to 6"]
25
+ V2 -> V7 [label="from 2 to 7"]
26
+ V2 -> V8 [label="from 2 to 8"]
27
+ V2 -> V9 [label="from 2 to 9"]
28
+ V3 -> V5 [label="from 3 to 5"]
29
+ V3 -> V6 [label="from 3 to 6"]
30
+ V3 -> V7 [label="from 3 to 7"]
31
+ V3 -> V8 [label="from 3 to 8"]
32
+ V3 -> V9 [label="from 3 to 9"]
33
+ V4 -> V5 [label="from 4 to 5"]
34
+ V4 -> V6 [label="from 4 to 6"]
35
+ V4 -> V7 [label="from 4 to 7"]
36
+ V4 -> V8 [label="from 4 to 8"]
37
+ V4 -> V9 [label="from 4 to 9"]
38
+ }
Binary file
@@ -0,0 +1,144 @@
1
+ digraph G {
2
+ graph[]
3
+ V0 []
4
+ V1 []
5
+ V2 []
6
+ V3 []
7
+ V4 []
8
+ V5 []
9
+ V6 []
10
+ V7 []
11
+ V8 []
12
+ V9 []
13
+ V10 []
14
+ V11 []
15
+ V12 []
16
+ V13 []
17
+ V14 []
18
+ V15 []
19
+ V16 []
20
+ V17 []
21
+ V18 []
22
+ V19 []
23
+ V20 []
24
+ V0 -> V1 []
25
+ V0 -> V2 []
26
+ V0 -> V3 []
27
+ V0 -> V4 []
28
+ V0 -> V5 []
29
+ V0 -> V6 []
30
+ V0 -> V7 []
31
+ V0 -> V8 []
32
+ V0 -> V9 []
33
+ V0 -> V10 []
34
+ V1 -> V11 []
35
+ V2 -> V12 []
36
+ V3 -> V13 []
37
+ V4 -> V14 []
38
+ V5 -> V15 []
39
+ V6 -> V16 []
40
+ V7 -> V17 []
41
+ V8 -> V18 []
42
+ V9 -> V19 []
43
+ V10 -> V20 []
44
+ V1 -> V1 []
45
+ V1 -> V2 []
46
+ V1 -> V3 []
47
+ V1 -> V4 []
48
+ V1 -> V5 []
49
+ V1 -> V6 []
50
+ V1 -> V7 []
51
+ V1 -> V8 []
52
+ V1 -> V9 []
53
+ V1 -> V10 []
54
+ V2 -> V1 []
55
+ V2 -> V2 []
56
+ V2 -> V3 []
57
+ V2 -> V4 []
58
+ V2 -> V5 []
59
+ V2 -> V6 []
60
+ V2 -> V7 []
61
+ V2 -> V8 []
62
+ V2 -> V9 []
63
+ V2 -> V10 []
64
+ V3 -> V1 []
65
+ V3 -> V2 []
66
+ V3 -> V3 []
67
+ V3 -> V4 []
68
+ V3 -> V5 []
69
+ V3 -> V6 []
70
+ V3 -> V7 []
71
+ V3 -> V8 []
72
+ V3 -> V9 []
73
+ V3 -> V10 []
74
+ V4 -> V1 []
75
+ V4 -> V2 []
76
+ V4 -> V3 []
77
+ V4 -> V4 []
78
+ V4 -> V5 []
79
+ V4 -> V6 []
80
+ V4 -> V7 []
81
+ V4 -> V8 []
82
+ V4 -> V9 []
83
+ V4 -> V10 []
84
+ V5 -> V1 []
85
+ V5 -> V2 []
86
+ V5 -> V3 []
87
+ V5 -> V4 []
88
+ V5 -> V5 []
89
+ V5 -> V6 []
90
+ V5 -> V7 []
91
+ V5 -> V8 []
92
+ V5 -> V9 []
93
+ V5 -> V10 []
94
+ V6 -> V1 []
95
+ V6 -> V2 []
96
+ V6 -> V3 []
97
+ V6 -> V4 []
98
+ V6 -> V5 []
99
+ V6 -> V6 []
100
+ V6 -> V7 []
101
+ V6 -> V8 []
102
+ V6 -> V9 []
103
+ V6 -> V10 []
104
+ V7 -> V1 []
105
+ V7 -> V2 []
106
+ V7 -> V3 []
107
+ V7 -> V4 []
108
+ V7 -> V5 []
109
+ V7 -> V6 []
110
+ V7 -> V7 []
111
+ V7 -> V8 []
112
+ V7 -> V9 []
113
+ V7 -> V10 []
114
+ V8 -> V1 []
115
+ V8 -> V2 []
116
+ V8 -> V3 []
117
+ V8 -> V4 []
118
+ V8 -> V5 []
119
+ V8 -> V6 []
120
+ V8 -> V7 []
121
+ V8 -> V8 []
122
+ V8 -> V9 []
123
+ V8 -> V10 []
124
+ V9 -> V1 []
125
+ V9 -> V2 []
126
+ V9 -> V3 []
127
+ V9 -> V4 []
128
+ V9 -> V5 []
129
+ V9 -> V6 []
130
+ V9 -> V7 []
131
+ V9 -> V8 []
132
+ V9 -> V9 []
133
+ V9 -> V10 []
134
+ V10 -> V1 []
135
+ V10 -> V2 []
136
+ V10 -> V3 []
137
+ V10 -> V4 []
138
+ V10 -> V5 []
139
+ V10 -> V6 []
140
+ V10 -> V7 []
141
+ V10 -> V8 []
142
+ V10 -> V9 []
143
+ V10 -> V10 []
144
+ }
@@ -0,0 +1,43 @@
1
+ require 'test/unit'
2
+ require 'yargi'
3
+
4
+ module Yargi
5
+
6
+ class VertexSetTest < Test::Unit::TestCase
7
+
8
+ module Center; end
9
+ module AtOne; end
10
+ module AtTwo; end
11
+
12
+ def setup
13
+ @star = Yargi::Digraph.new
14
+ @center = @star.add_vertex(Center)
15
+ @atone = @star.add_n_vertices(10, AtOne)
16
+ @attwo = @star.add_n_vertices(10, AtTwo)
17
+ @star.connect(@center, @atone)
18
+ @atone.zip(@attwo).each do |pair|
19
+ @star.connect(pair[0], pair[1])
20
+ end
21
+ #puts @star.to_dot
22
+ end
23
+
24
+ def test_in_and_out_edges
25
+ assert_equal [], VertexSet[@center].in_edges
26
+ assert_equal @atone.in_edges, VertexSet[@center].out_edges
27
+ assert_equal @attwo.in_edges, @atone.out_edges
28
+ end
29
+
30
+ def test_in_and_out_edges_no_duplicate
31
+ @star.connect(@atone, @atone)
32
+ assert_equal @atone.in_edges, @atone.in_edges.uniq
33
+ assert_equal @atone.out_edges, @atone.out_edges.uniq
34
+ assert_equal @atone, VertexSet[@center].out_edges.target
35
+ sortproc = Kernel.lambda {|v1,v2| v1.index <=> v2.index}
36
+ assert_equal (@atone+@attwo).sort(&sortproc), @atone.out_edges.target.sort(&sortproc)
37
+ assert_equal @atone.sort(&sortproc), @atone.out_edges.source.sort(&sortproc)
38
+ assert_equal (@atone+[@center]).sort(&sortproc), @atone.in_edges.source.sort(&sortproc)
39
+ end
40
+
41
+ end # class VertexSetTest
42
+
43
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yargi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Bernard Lambeau
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-20 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Mutable graphs made easy.
17
+ email: blambeau@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ - LICENCE
25
+ files:
26
+ - lib/yargi
27
+ - lib/yargi/digraph.rb
28
+ - lib/yargi/digraph_edge.rb
29
+ - lib/yargi/digraph_vertex.rb
30
+ - lib/yargi/edge_set.rb
31
+ - lib/yargi/element_set.rb
32
+ - lib/yargi/markable.rb
33
+ - lib/yargi/predicate.rb
34
+ - lib/yargi/vertex_set.rb
35
+ - lib/yargi.rb
36
+ - test/test_all.rb
37
+ - test/yargi
38
+ - test/yargi/digraph_set_features_test.rb
39
+ - test/yargi/digraph_test.rb
40
+ - test/yargi/digraph_vertex_test.rb
41
+ - test/yargi/documentation_test.rb
42
+ - test/yargi/element_set_test.rb
43
+ - test/yargi/hypotheses_test.rb
44
+ - test/yargi/markable_test.rb
45
+ - test/yargi/predicate_test.rb
46
+ - test/yargi/README-example.dot
47
+ - test/yargi/README-example.gif
48
+ - test/yargi/source-sink.dot
49
+ - test/yargi/source-sink.gif
50
+ - test/yargi/star.dot
51
+ - test/yargi/vertex_set_test.rb
52
+ - README
53
+ - LICENCE
54
+ has_rdoc: true
55
+ homepage: https://code.chefbe.net/
56
+ post_install_message:
57
+ rdoc_options:
58
+ - --title
59
+ - Yargi - Yet Another Ruby Graph Implementation
60
+ - --main
61
+ - README
62
+ - --line-numbers
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: "0"
70
+ version:
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: "0"
76
+ version:
77
+ requirements: []
78
+
79
+ rubyforge_project:
80
+ rubygems_version: 1.3.1
81
+ signing_key:
82
+ specification_version: 2
83
+ summary: Yet Another Ruby Graph Implementation
84
+ test_files: []
85
+