rgl 0.5.6 → 0.5.7
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/ChangeLog +17 -1
- data/README.md +7 -4
- data/Rakefile +14 -14
- data/examples/examples.rb +11 -9
- data/examples/unix.dot +53 -0
- data/lib/rgl/base.rb +1 -1
- data/lib/rgl/graphxml.rb +2 -2
- data/lib/rgl/rdot.rb +1 -1
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b92e64e8461dc9a3f9f471e68c9a2876e93a44f5b858e0a40a30b6933e5136a8
|
4
|
+
data.tar.gz: f820274113a375f61620272c1eb6a11127562867e8fe9af8bc20cf075aca5fc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e887b25cc41ead029b67a58a21ce02536baf92a44912d8ff2208b04477ffd9556fde68dd0c4663caa9341cecd58b8102bfafe7df7512b5cbc7285764d0952e2
|
7
|
+
data.tar.gz: a610a0225a9c63fb83a841053377b07ee0d59dabf12a4379c30a1f8c27c5618e245f9d10f5f3f5c2aef08ddb323c3e4d357ad432d0c24be49701f8fe336340ef
|
data/ChangeLog
CHANGED
@@ -1,4 +1,20 @@
|
|
1
|
-
2019-01 Release 0.5.
|
1
|
+
2019-01 Release 0.5.7
|
2
|
+
|
3
|
+
Horst Duchene
|
4
|
+
* Fully automate dev setup with Gitpod (41dd00)
|
5
|
+
* Add Dockerfile to install graphviz (2bd738)
|
6
|
+
* Examples do not call dotty (6bba96)
|
7
|
+
* Add ruby license file (a21aa5)
|
8
|
+
ujihisa <ujihisa@users.noreply.github.com>
|
9
|
+
* Test against Ruby 2.6 and 2.7 as well (50ac7c)
|
10
|
+
* Fix dead links (9184f3)
|
11
|
+
Harry Lascelles <hlascelles@users.noreply.github.com>
|
12
|
+
* Update .travis.yml (45b9a2)
|
13
|
+
* Make the links more explicit (95dc3b)
|
14
|
+
Harry Lascelles
|
15
|
+
* Add explicit license to gemspec (de3647)
|
16
|
+
|
17
|
+
2019-01 Release 0.5.6
|
2
18
|
|
3
19
|
Artemy Kirienko
|
4
20
|
* PR #42 Add method Graph#path?(u, v) to check if a path exists between two vertices
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Ruby Graph Library (RGL) [<img src="https://secure.travis-ci.org/monora/rgl.png?branch=master" alt="Build Status" />](https://travis-ci.org/monora/rgl) [<img src="https://codeclimate.com/github/monora/rgl/badges/coverage.svg" />](https://codeclimate.com/github/monora/rgl/coverage) [<img src="https://badge.fury.io/rb/rgl.svg" alt="Version"/>](https://badge.fury.io/rb/rgl)
|
1
|
+
# Ruby Graph Library (RGL) [<img src="https://secure.travis-ci.org/monora/rgl.png?branch=master" alt="Build Status" />](https://travis-ci.org/monora/rgl) [<img src="https://codeclimate.com/github/monora/rgl/badges/coverage.svg" />](https://codeclimate.com/github/monora/rgl/coverage) [<img src="https://badge.fury.io/rb/rgl.svg" alt="Version"/>](https://badge.fury.io/rb/rgl)[](https://gitpod.io/#https://github.com/monora/rgl)
|
2
2
|
|
3
3
|
RGL is a framework for graph data structures and algorithms.
|
4
4
|
|
@@ -123,6 +123,8 @@ After that you can run the tests:
|
|
123
123
|
|
124
124
|
## Example irb session with RGL
|
125
125
|
|
126
|
+
% irb -Ilib
|
127
|
+
|
126
128
|
irb> require 'rgl/adjacency'
|
127
129
|
irb> dg=RGL::DirectedAdjacencyGraph[1,2 ,2,3 ,2,4, 4,5, 6,4, 1,6]
|
128
130
|
# Use DOT to visualize this graph:
|
@@ -259,6 +261,7 @@ See also http://github.com/monora/rgl/contributors.
|
|
259
261
|
|
260
262
|
## Copying
|
261
263
|
|
262
|
-
RGL is Copyright (c) 2002,2004,2005,2008,2013,2015,2019 by Horst
|
263
|
-
free software, and may be redistributed under the
|
264
|
-
|
264
|
+
RGL is Copyright (c) 2002,2004,2005,2008,2013,2015,2019,2020 by Horst
|
265
|
+
Duchene. It is free software, and may be redistributed under the [Ruby
|
266
|
+
license](https://en.wikipedia.org/wiki/Ruby_License) and terms specified in
|
267
|
+
the LICENSE file.
|
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ require 'rgl/base' # require base module to get RGL_VERSION
|
|
15
15
|
SOURCES = FileList['lib/**/*.rb']
|
16
16
|
|
17
17
|
# The default task is run if rake is given no explicit arguments.
|
18
|
-
desc
|
18
|
+
desc 'Default Task'
|
19
19
|
task :default => :test
|
20
20
|
|
21
21
|
# Define a test task.
|
@@ -28,7 +28,7 @@ end
|
|
28
28
|
|
29
29
|
# Git tagging
|
30
30
|
|
31
|
-
desc
|
31
|
+
desc 'Commit all changes as a new version commit. Tag the commit with v<version> tag'
|
32
32
|
task :tag do
|
33
33
|
puts "Committing and tagging version #{RGL_VERSION}"
|
34
34
|
`git commit -am 'Version #{RGL_VERSION}'`
|
@@ -44,13 +44,13 @@ Bundler::GemHelper.install_tasks
|
|
44
44
|
# TAGS ---------------------------------------------------------------
|
45
45
|
|
46
46
|
file 'tags' => SOURCES do
|
47
|
-
print
|
48
|
-
sh %
|
49
|
-
puts
|
47
|
+
print 'Running ctags...'
|
48
|
+
sh %(ctags #{SOURCES.join(' ')}) # vi tags
|
49
|
+
puts 'done.'
|
50
50
|
end
|
51
51
|
|
52
52
|
file 'TAGS' => SOURCES do
|
53
|
-
sh %
|
53
|
+
sh %(etags #{SOURCES.join(' ')}) # emacs TAGS
|
54
54
|
end
|
55
55
|
|
56
56
|
# Misc tasks =========================================================
|
@@ -73,34 +73,34 @@ def show_line(msg, lines, loc)
|
|
73
73
|
printf "%6s %6s %s\n", lines.to_s, loc.to_s, msg
|
74
74
|
end
|
75
75
|
|
76
|
-
desc
|
76
|
+
desc 'Count lines in the main files'
|
77
77
|
task :lines do
|
78
78
|
total_lines = 0
|
79
79
|
total_code = 0
|
80
|
-
show_line(
|
80
|
+
show_line('File Name', 'LINES', 'LOC')
|
81
81
|
SOURCES.each do |fn|
|
82
82
|
lines, codelines = count_lines(fn)
|
83
83
|
show_line(fn, lines, codelines)
|
84
84
|
total_lines += lines
|
85
|
-
total_code
|
85
|
+
total_code += codelines
|
86
86
|
end
|
87
|
-
show_line(
|
87
|
+
show_line('TOTAL', total_lines, total_code)
|
88
88
|
end
|
89
89
|
|
90
90
|
# simple rake task to output a changelog between two commits, tags ...
|
91
91
|
# output is formatted simply, commits are grouped under each author name
|
92
92
|
#
|
93
|
-
desc
|
94
|
-
task :changelog, :since_c, :until_c do |t,args|
|
93
|
+
desc 'generate changelog with nice clean output'
|
94
|
+
task :changelog, :since_c, :until_c do |t, args|
|
95
95
|
since_c = args[:since_c] || `git tag | tail -1`.chomp
|
96
96
|
until_c = args[:until_c]
|
97
|
-
cmd
|
97
|
+
cmd = `git log --pretty='format:%ci::%an <%ae>::%s::%H' #{since_c}..#{until_c}`
|
98
98
|
|
99
99
|
entries = Hash.new
|
100
100
|
changelog_content = String.new
|
101
101
|
|
102
102
|
cmd.split("\n").each do |entry|
|
103
|
-
_, author, subject, hash = entry.chomp.split(
|
103
|
+
_, author, subject, hash = entry.chomp.split('::')
|
104
104
|
entries[author] = Array.new unless entries[author]
|
105
105
|
entries[author] << "#{subject} (#{hash[0..5]})" unless subject =~ /Merge/
|
106
106
|
end
|
data/examples/examples.rb
CHANGED
@@ -77,7 +77,7 @@ def bfs_example(g = cycle(5), start = g.detect { |x| true })
|
|
77
77
|
end
|
78
78
|
|
79
79
|
# Would like to have GraphXML here
|
80
|
-
def graph_from_dotfile
|
80
|
+
def graph_from_dotfile(file)
|
81
81
|
g = RGL::AdjacencyGraph.new
|
82
82
|
pattern = /\s*([^\"]+)[\"\s]*--[\"\s]*([^\"\[\;]+)/ # ugly but works
|
83
83
|
IO.foreach(file) { |line|
|
@@ -94,21 +94,23 @@ def graph_from_dotfile (file)
|
|
94
94
|
g
|
95
95
|
end
|
96
96
|
|
97
|
-
# ruby -Ilib
|
98
|
-
|
97
|
+
# ruby -Ilib examples/examples.rb
|
99
98
|
if $0 == __FILE__
|
100
99
|
require 'rgl/dot'
|
101
100
|
|
102
101
|
dg = RGL::DirectedAdjacencyGraph[1,2, 2,3, 2,4, 4,5, 6,4, 1,6]
|
103
|
-
dg.dotty
|
104
102
|
dg.write_to_graphic_file
|
105
|
-
bfs_example(dg, 1).dotty
|
106
|
-
bfs_example(graph_from_dotfile('dot/unix.dot'), 'Interdata').dotty({ 'label' => 'Interdata Nachfolger', 'fontsize' => 12 })
|
107
103
|
|
104
|
+
# BFS tree from 1 of dg:
|
105
|
+
bfs_example(dg, 1).write_to_graphic_file('png', 'bfs_example')
|
106
|
+
|
107
|
+
# Unix history as a graph:
|
108
|
+
g = bfs_example(graph_from_dotfile('examples/unix.dot'), 'Interdata')
|
109
|
+
g.write_to_graphic_file('png', 'unix', { 'label' => 'Interdata Nachfolger', 'fontsize' => 12 })
|
110
|
+
|
111
|
+
# Modules included by AdjacencyGraph:
|
108
112
|
g = module_graph
|
109
113
|
tree = bfs_example(module_graph, RGL::AdjacencyGraph)
|
110
114
|
g = g.vertices_filtered_by { |v| tree.has_vertex? v }
|
111
|
-
g.write_to_graphic_file
|
112
|
-
g.dotty
|
115
|
+
g.write_to_graphic_file('png', 'module_graph')
|
113
116
|
end
|
114
|
-
|
data/examples/unix.dot
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
/* courtesy Ian Darwin and Geoff Collyer, Softquad Inc. */
|
2
|
+
digraph unix {
|
3
|
+
size="6,6";
|
4
|
+
"5th Edition" -> "6th Edition";
|
5
|
+
"5th Edition" -> "PWB 1.0";
|
6
|
+
"6th Edition" -> "LSX";
|
7
|
+
"6th Edition" -> "1 BSD";
|
8
|
+
"6th Edition" -> "Mini Unix";
|
9
|
+
"6th Edition" -> "Wollongong";
|
10
|
+
"6th Edition" -> "Interdata";
|
11
|
+
"Interdata" -> "Unix/TS 3.0";
|
12
|
+
"Interdata" -> "PWB 2.0";
|
13
|
+
"Interdata" -> "7th Edition";
|
14
|
+
"7th Edition" -> "8th Edition";
|
15
|
+
"7th Edition" -> "32V";
|
16
|
+
"7th Edition" -> "V7M";
|
17
|
+
"7th Edition" -> "Ultrix-11";
|
18
|
+
"7th Edition" -> "Xenix";
|
19
|
+
"7th Edition" -> "UniPlus+";
|
20
|
+
"V7M" -> "Ultrix-11";
|
21
|
+
"8th Edition" -> "9th Edition";
|
22
|
+
"1 BSD" -> "2 BSD";
|
23
|
+
"2 BSD" -> "2.8 BSD";
|
24
|
+
"2.8 BSD" -> "Ultrix-11";
|
25
|
+
"2.8 BSD" -> "2.9 BSD";
|
26
|
+
"32V" -> "3 BSD";
|
27
|
+
"3 BSD" -> "4 BSD";
|
28
|
+
"4 BSD" -> "4.1 BSD";
|
29
|
+
"4.1 BSD" -> "4.2 BSD";
|
30
|
+
"4.1 BSD" -> "2.8 BSD";
|
31
|
+
"4.1 BSD" -> "8th Edition";
|
32
|
+
"4.2 BSD" -> "4.3 BSD";
|
33
|
+
"4.2 BSD" -> "Ultrix-32";
|
34
|
+
"PWB 1.0" -> "PWB 1.2";
|
35
|
+
"PWB 1.0" -> "USG 1.0";
|
36
|
+
"PWB 1.2" -> "PWB 2.0";
|
37
|
+
"USG 1.0" -> "CB Unix 1";
|
38
|
+
"USG 1.0" -> "USG 2.0";
|
39
|
+
"CB Unix 1" -> "CB Unix 2";
|
40
|
+
"CB Unix 2" -> "CB Unix 3";
|
41
|
+
"CB Unix 3" -> "Unix/TS++";
|
42
|
+
"CB Unix 3" -> "PDP-11 Sys V";
|
43
|
+
"USG 2.0" -> "USG 3.0";
|
44
|
+
"USG 3.0" -> "Unix/TS 3.0";
|
45
|
+
"PWB 2.0" -> "Unix/TS 3.0";
|
46
|
+
"Unix/TS 1.0" -> "Unix/TS 3.0";
|
47
|
+
"Unix/TS 3.0" -> "TS 4.0";
|
48
|
+
"Unix/TS++" -> "TS 4.0";
|
49
|
+
"CB Unix 3" -> "TS 4.0";
|
50
|
+
"TS 4.0" -> "System V.0";
|
51
|
+
"System V.0" -> "System V.2";
|
52
|
+
"System V.2" -> "System V.3";
|
53
|
+
}
|
data/lib/rgl/base.rb
CHANGED
data/lib/rgl/graphxml.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# graphxml.rb
|
2
2
|
#
|
3
3
|
# This file contains minimal support for creating RGL graphs from the GraphML
|
4
|
-
# format (see http://
|
4
|
+
# format (see http://graphml.graphdrawing.org/). The main purpose is to
|
5
5
|
# have a rich set of example graphs to have some more tests.
|
6
6
|
#
|
7
7
|
# See the examples directory, which contains a subdirectory _north_ with the
|
@@ -48,7 +48,7 @@ module RGL
|
|
48
48
|
end # class MutableGraphParser
|
49
49
|
|
50
50
|
# Initializes an RGL graph from a subset of the GraphML format given in
|
51
|
-
# +source+ (see http://
|
51
|
+
# +source+ (see http://graphml.graphdrawing.org/).
|
52
52
|
#
|
53
53
|
def from_graphxml(source)
|
54
54
|
listener = MutableGraphParser.new(self)
|
data/lib/rgl/rdot.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rgl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Horst Duchene
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire: rgl/base
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-12-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: stream
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.5.
|
20
|
+
version: 0.5.3
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.5.
|
27
|
+
version: 0.5.3
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: lazy_priority_queue
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- examples/north/g.14.9.graphml
|
166
166
|
- examples/north2.rb
|
167
167
|
- examples/rdep-rgl.rb
|
168
|
+
- examples/unix.dot
|
168
169
|
- lib/rgl/adjacency.rb
|
169
170
|
- lib/rgl/base.rb
|
170
171
|
- lib/rgl/bellman_ford.rb
|
@@ -214,9 +215,10 @@ files:
|
|
214
215
|
- test/traversal_test.rb
|
215
216
|
- test/undirected_graph_test.rb
|
216
217
|
homepage: https://github.com/monora/rgl
|
217
|
-
licenses:
|
218
|
+
licenses:
|
219
|
+
- ruby
|
218
220
|
metadata: {}
|
219
|
-
post_install_message:
|
221
|
+
post_install_message:
|
220
222
|
rdoc_options:
|
221
223
|
- "--title"
|
222
224
|
- RGL - Ruby Graph Library
|
@@ -237,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
237
239
|
version: '0'
|
238
240
|
requirements: []
|
239
241
|
rubygems_version: 3.0.6
|
240
|
-
signing_key:
|
242
|
+
signing_key:
|
241
243
|
specification_version: 4
|
242
244
|
summary: Ruby Graph Library
|
243
245
|
test_files: []
|