graphos 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +6 -0
- data/graphos.gemspec +28 -0
- data/lib/graphos.rb +9 -0
- data/lib/graphos/algorithm/dijkstra.rb +58 -0
- data/lib/graphos/algorithm/prim.rb +44 -0
- data/lib/graphos/path.rb +39 -0
- data/lib/graphos/version.rb +3 -0
- data/lib/graphos/weighted/edge.rb +15 -0
- data/lib/graphos/weighted/graph.rb +38 -0
- data/lib/graphos/weighted/node.rb +38 -0
- data/lib/graphos/weighted/text_factory.rb +15 -0
- data/test/dijsktra_test.rb +38 -0
- data/test/fixtures/wgraph.txt +4 -0
- data/test/minitest_helper.rb +3 -0
- data/test/prim_test.rb +24 -0
- data/test/weighted/graph_test.rb +55 -0
- data/test/weighted/graph_text_factory_test.rb +14 -0
- metadata +157 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0c01223437fbfd0807465f7c3e906beea53a3968
|
4
|
+
data.tar.gz: c22534c9913af9e5fe26f349ea47acae83076338
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1bc419449e7f18fed8132f94b9adf7322a9e556f61f0cc281a488d8cd856b45b3477596e17762e2205427dddabd8c84806881363719e19c779e1be83528b6984
|
7
|
+
data.tar.gz: 22504d8ce07925db07a2aab39d76db7b0201be6e0c0ff4f35205b9b767a9d602a0d963a5f5f0a5e34e34daf19d8ff27e9e0928cca17fc4d00dfc3675b64660b5
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Bernardo Amorim
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Graphos
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'graphos'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install graphos
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( https://github.com/[my-github-username]/graphos/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/graphos.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'graphos/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "graphos"
|
8
|
+
spec.version = Graphos::VERSION
|
9
|
+
spec.authors = ["Bernardo Amorim", "Pedro Volpi"]
|
10
|
+
spec.email = ["contato@bamorim.com", "pedrovolpi@poli.ufrj.br"]
|
11
|
+
spec.summary = %q{Educational gem to Graph Theory @ UFRJ}
|
12
|
+
spec.description = %q{This gems implements some graph algorithms and representations.}
|
13
|
+
spec.homepage = "https://github.com/bamorim/graphos"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "minitest", "~> 5.4"
|
24
|
+
spec.add_development_dependency "minitest-reporters", "~> 1.0"
|
25
|
+
spec.add_development_dependency "pry", "~>0.10"
|
26
|
+
|
27
|
+
spec.add_dependency "algorithms", "~>0.6"
|
28
|
+
end
|
data/lib/graphos.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require "algorithms"
|
2
|
+
require "graphos/path"
|
3
|
+
module Graphos
|
4
|
+
module Algorithm
|
5
|
+
include Containers
|
6
|
+
##
|
7
|
+
# Runs the dijstra algorithm on a given graph
|
8
|
+
# at a starting node
|
9
|
+
# This uses a Heap to get the lightest edge
|
10
|
+
def self.dijkstra graph, initial
|
11
|
+
#OK? E o path?
|
12
|
+
fathers = Array.new(graph.size)
|
13
|
+
|
14
|
+
#os paf
|
15
|
+
allPaths = Array.new(graph.size)
|
16
|
+
|
17
|
+
#OK #dist[v] = infinito
|
18
|
+
costs = Array.new(graph.size, Float::INFINITY)
|
19
|
+
#dist[s] = 0
|
20
|
+
costs[initial] = 0
|
21
|
+
|
22
|
+
#OK
|
23
|
+
heap = Heap.new{|x,y| (costs[x] <=> costs[y]) == -1}
|
24
|
+
(0...graph.size).each{|i| heap.push(i)}
|
25
|
+
|
26
|
+
update_cost = -> (idx,cost) do
|
27
|
+
costs[idx] = cost
|
28
|
+
heap.change_key(idx,idx)
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
#Para cada vértice v
|
33
|
+
#enquanto heap (S-V) != 0
|
34
|
+
while idx=heap.pop
|
35
|
+
#Selecione u em V-S, tal que dist[u] é mínima
|
36
|
+
u = graph[idx]
|
37
|
+
distu = costs[idx]
|
38
|
+
allPaths[idx] ||= Path.new
|
39
|
+
#Para cada vizinho v (edge.to) de u faça
|
40
|
+
u.edges.each do |edge|
|
41
|
+
#Se dist[v] > dist[u] + w(u,v) então
|
42
|
+
if costs[edge.to.index] > distu + edge.weight
|
43
|
+
#dist[v] = dist[u] + w(u,v)
|
44
|
+
fathers[edge.to.index] = u.index
|
45
|
+
update_cost.call(edge.to.index, distu + edge.weight)
|
46
|
+
#criar o Path entre root e v
|
47
|
+
#se existe já, tem q atualizar. O novo é o do pai + ele msm
|
48
|
+
allPaths[edge.to.index] = allPaths[u.index] + Path.new(edge)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
allPaths
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "algorithms"
|
2
|
+
module Graphos
|
3
|
+
module Algorithm
|
4
|
+
include Containers
|
5
|
+
|
6
|
+
##
|
7
|
+
# Runs the prim algorithm in order to
|
8
|
+
# find a MST for a given graph.
|
9
|
+
|
10
|
+
def self.prim graph, initial
|
11
|
+
fathers = Array.new(graph.size)
|
12
|
+
|
13
|
+
costs = Array.new(graph.size, Float::INFINITY)
|
14
|
+
costs[initial] = 0
|
15
|
+
|
16
|
+
heap = Heap.new{|x,y| (costs[x] <=> costs[y]) == -1}
|
17
|
+
(0..graph.size-1).each{|i| heap.push(i)}
|
18
|
+
|
19
|
+
update_cost = -> (idx,cost) do
|
20
|
+
costs[idx] = cost
|
21
|
+
heap.change_key(idx,idx)
|
22
|
+
end
|
23
|
+
|
24
|
+
while idx=heap.pop
|
25
|
+
node = graph[idx]
|
26
|
+
node.edges.each do |edge|
|
27
|
+
if costs[edge.to.index] > edge.weight
|
28
|
+
fathers[edge.to.index] = node.index
|
29
|
+
update_cost.call(edge.to.index, edge.weight)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
result = Weighted::Graph.new graph.size
|
35
|
+
fathers.each_with_index do |f,c|
|
36
|
+
if f
|
37
|
+
result.add_edge(f, c, costs[c])
|
38
|
+
end
|
39
|
+
end
|
40
|
+
result
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
data/lib/graphos/path.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require "algorithms"
|
2
|
+
module Graphos
|
3
|
+
##
|
4
|
+
# This class represents a collection of edges
|
5
|
+
# When adding an edge that does not start at
|
6
|
+
# the last node, it raises an error
|
7
|
+
|
8
|
+
class Path
|
9
|
+
class IncorretPathError < StandardError; end
|
10
|
+
|
11
|
+
attr_reader :cost, :path
|
12
|
+
def initialize edge=nil
|
13
|
+
if edge
|
14
|
+
@cost = edge.weight
|
15
|
+
@path = [edge]
|
16
|
+
else
|
17
|
+
@cost = 0
|
18
|
+
@path = []
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def add_edge edge
|
23
|
+
if @path.last.to != edge.from
|
24
|
+
raise IncorrectPathError.new
|
25
|
+
end
|
26
|
+
@path += [node]
|
27
|
+
@cost += weight
|
28
|
+
end
|
29
|
+
|
30
|
+
def merge! paf
|
31
|
+
@cost += paf.cost
|
32
|
+
@path = @path + paf.path
|
33
|
+
end
|
34
|
+
|
35
|
+
def + path
|
36
|
+
dup.tap{|d| d.merge! path }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Graphos
|
2
|
+
module Weighted
|
3
|
+
|
4
|
+
# :nodoc:
|
5
|
+
class Graph
|
6
|
+
|
7
|
+
require "graphos/weighted/node"
|
8
|
+
require "graphos/weighted/edge"
|
9
|
+
|
10
|
+
|
11
|
+
def initialize size
|
12
|
+
@nodes = (0..size-1).map{|i| Node.new i }
|
13
|
+
end
|
14
|
+
|
15
|
+
def size
|
16
|
+
@nodes.size
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_edge from, to, weight
|
20
|
+
@nodes[from].add_edge(@nodes[to],weight)
|
21
|
+
@nodes[to].add_edge(@nodes[from],weight)
|
22
|
+
end
|
23
|
+
|
24
|
+
def edge from, to
|
25
|
+
@nodes[from].edge(to)
|
26
|
+
end
|
27
|
+
|
28
|
+
def [] i
|
29
|
+
@nodes[i]
|
30
|
+
end
|
31
|
+
|
32
|
+
def each_node
|
33
|
+
@nodes.each{|n| yield n}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Graphos
|
2
|
+
module Weighted
|
3
|
+
|
4
|
+
##
|
5
|
+
# This class represents a node in a weighted graph
|
6
|
+
|
7
|
+
class Node
|
8
|
+
attr_reader :index, :edges
|
9
|
+
def initialize index
|
10
|
+
@index = index
|
11
|
+
@edges = []
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_edge to, weight
|
15
|
+
# Does a O(n) check deleting existing edges
|
16
|
+
@edges.delete_if{|n| n.to == to}
|
17
|
+
@edges << Edge.new(self, to, weight)
|
18
|
+
end
|
19
|
+
|
20
|
+
def degree
|
21
|
+
@edges.inject(0){|sum,e| sum+e.weight }
|
22
|
+
end
|
23
|
+
|
24
|
+
def neighbor_of? index
|
25
|
+
@edges.any? {|node| node.to.index == index }
|
26
|
+
end
|
27
|
+
|
28
|
+
def neighbors
|
29
|
+
@edges.map{|edge| edge.to}
|
30
|
+
end
|
31
|
+
|
32
|
+
def edge to
|
33
|
+
@edges.lazy.select{|e| e.to.index == to}.first
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Graphos
|
2
|
+
module Weighted
|
3
|
+
module TextFactory
|
4
|
+
def self.read path
|
5
|
+
f = File.open(path,"r")
|
6
|
+
graph = Graph.new(f.gets.to_i)
|
7
|
+
while(line=f.gets)
|
8
|
+
args = line.split(/[ \n]+/)
|
9
|
+
graph.add_edge args[0].to_i-1, args[1].to_i-1, args[2].to_f
|
10
|
+
end
|
11
|
+
graph
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require_relative "minitest_helper.rb"
|
2
|
+
require "graphos/weighted/graph"
|
3
|
+
require "graphos/algorithm/dijkstra"
|
4
|
+
|
5
|
+
class DijkstraTest < MiniTest::Test
|
6
|
+
def test_dijskstra
|
7
|
+
graph = Graphos::Weighted::Graph.new(5)
|
8
|
+
graph.add_edge 0, 1, 2
|
9
|
+
graph.add_edge 0, 2, 1
|
10
|
+
graph.add_edge 0, 4, 1
|
11
|
+
graph.add_edge 1, 2, 3
|
12
|
+
graph.add_edge 2, 4, 2
|
13
|
+
graph.add_edge 2, 3, 4
|
14
|
+
|
15
|
+
dij = Graphos::Algorithm.dijkstra graph, 0
|
16
|
+
|
17
|
+
assert_equal([],ipath(dij[0]))
|
18
|
+
assert_equal(0,dij[0].cost)
|
19
|
+
|
20
|
+
assert_equal([1],ipath(dij[1]))
|
21
|
+
assert_equal(2,dij[1].cost)
|
22
|
+
|
23
|
+
assert_equal([2],ipath(dij[2]))
|
24
|
+
assert_equal(1,dij[2].cost)
|
25
|
+
|
26
|
+
assert_equal([2,3],ipath(dij[3]))
|
27
|
+
assert_equal(5,dij[3].cost)
|
28
|
+
|
29
|
+
assert_equal([4],ipath(dij[4]))
|
30
|
+
assert_equal(1,dij[4].cost)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def ipath path
|
36
|
+
path.path.map{|e| e.to.index}
|
37
|
+
end
|
38
|
+
end
|
data/test/prim_test.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative "minitest_helper.rb"
|
2
|
+
require "graphos/weighted/graph"
|
3
|
+
require "graphos/algorithm/prim"
|
4
|
+
|
5
|
+
class PrimTest < MiniTest::Test
|
6
|
+
def test_prim
|
7
|
+
graph = Graphos::Weighted::Graph.new(5)
|
8
|
+
graph.add_edge 0, 1, 2
|
9
|
+
graph.add_edge 0, 2, 1
|
10
|
+
graph.add_edge 0, 4, 1
|
11
|
+
graph.add_edge 1, 2, 3
|
12
|
+
graph.add_edge 2, 4, 2
|
13
|
+
graph.add_edge 2, 3, 4
|
14
|
+
|
15
|
+
mst = Graphos::Algorithm.prim graph, 0
|
16
|
+
|
17
|
+
assert_equal(nil, mst.edge(1,2))
|
18
|
+
assert_equal(nil, mst.edge(2,4))
|
19
|
+
assert_equal(2, mst.edge(1,0).weight)
|
20
|
+
assert_equal(1, mst.edge(0,4).weight)
|
21
|
+
assert_equal(1, mst.edge(0,2).weight)
|
22
|
+
assert_equal(4, mst.edge(2,3).weight)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require_relative "../minitest_helper.rb"
|
2
|
+
require "graphos/weighted/graph"
|
3
|
+
|
4
|
+
class WeightedGraphTest < MiniTest::Test
|
5
|
+
def test_initializing_and_size
|
6
|
+
graph = Graphos::Weighted::Graph.new 10
|
7
|
+
assert_equal(10, graph.size)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_degrees
|
11
|
+
graph = example
|
12
|
+
|
13
|
+
assert_equal(5, graph[0].degree)
|
14
|
+
assert_equal(7, graph[2].degree)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_edges
|
18
|
+
graph = example
|
19
|
+
assert_equal(3, graph.edge(0,1).weight)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_neighborhood
|
23
|
+
graph = example
|
24
|
+
|
25
|
+
assert(graph[0].neighbor_of? 1)
|
26
|
+
refute(graph[0].neighbor_of? 4)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_get_neighbors
|
30
|
+
graph = example
|
31
|
+
|
32
|
+
assert_equal(2, graph[0].neighbors.size)
|
33
|
+
assert_equal(3, graph[1].neighbors.size)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_edge_overwrite
|
37
|
+
graph = Graphos::Weighted::Graph.new 2
|
38
|
+
graph.add_edge(0,1,2)
|
39
|
+
graph.add_edge(0,1,3)
|
40
|
+
assert_equal(3, graph.edge(0,1).weight)
|
41
|
+
assert_equal(1, graph[0].edges.count)
|
42
|
+
assert_equal(1, graph[1].edges.count)
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def example
|
48
|
+
graph = Graphos::Weighted::Graph.new 4
|
49
|
+
graph.add_edge(0,1,3)
|
50
|
+
graph.add_edge(0,2,2)
|
51
|
+
graph.add_edge(1,2,5)
|
52
|
+
graph.add_edge(1,3,10)
|
53
|
+
graph
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require_relative "../minitest_helper.rb"
|
2
|
+
require "graphos/weighted/graph"
|
3
|
+
require "graphos/weighted/text_factory"
|
4
|
+
|
5
|
+
class WeightedGraphTextFactoryTest < MiniTest::Test
|
6
|
+
def test_text_factory
|
7
|
+
graph = Graphos::Weighted::TextFactory.read("test/fixtures/wgraph.txt")
|
8
|
+
|
9
|
+
assert_equal(3, graph.size)
|
10
|
+
assert_equal(1.5, graph.edge(0,1).weight)
|
11
|
+
assert_equal(2, graph.edge(0,2).weight)
|
12
|
+
assert_equal(2.5, graph.edge(1,2).weight)
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: graphos
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bernardo Amorim
|
8
|
+
- Pedro Volpi
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-11-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.7'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.7'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '10.0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '10.0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: minitest
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '5.4'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '5.4'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: minitest-reporters
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: pry
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0.10'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0.10'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: algorithms
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0.6'
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0.6'
|
98
|
+
description: This gems implements some graph algorithms and representations.
|
99
|
+
email:
|
100
|
+
- contato@bamorim.com
|
101
|
+
- pedrovolpi@poli.ufrj.br
|
102
|
+
executables: []
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files: []
|
105
|
+
files:
|
106
|
+
- ".gitignore"
|
107
|
+
- Gemfile
|
108
|
+
- LICENSE.txt
|
109
|
+
- README.md
|
110
|
+
- Rakefile
|
111
|
+
- graphos.gemspec
|
112
|
+
- lib/graphos.rb
|
113
|
+
- lib/graphos/algorithm/dijkstra.rb
|
114
|
+
- lib/graphos/algorithm/prim.rb
|
115
|
+
- lib/graphos/path.rb
|
116
|
+
- lib/graphos/version.rb
|
117
|
+
- lib/graphos/weighted/edge.rb
|
118
|
+
- lib/graphos/weighted/graph.rb
|
119
|
+
- lib/graphos/weighted/node.rb
|
120
|
+
- lib/graphos/weighted/text_factory.rb
|
121
|
+
- test/dijsktra_test.rb
|
122
|
+
- test/fixtures/wgraph.txt
|
123
|
+
- test/minitest_helper.rb
|
124
|
+
- test/prim_test.rb
|
125
|
+
- test/weighted/graph_test.rb
|
126
|
+
- test/weighted/graph_text_factory_test.rb
|
127
|
+
homepage: https://github.com/bamorim/graphos
|
128
|
+
licenses:
|
129
|
+
- MIT
|
130
|
+
metadata: {}
|
131
|
+
post_install_message:
|
132
|
+
rdoc_options: []
|
133
|
+
require_paths:
|
134
|
+
- lib
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 2.2.2
|
148
|
+
signing_key:
|
149
|
+
specification_version: 4
|
150
|
+
summary: Educational gem to Graph Theory @ UFRJ
|
151
|
+
test_files:
|
152
|
+
- test/dijsktra_test.rb
|
153
|
+
- test/fixtures/wgraph.txt
|
154
|
+
- test/minitest_helper.rb
|
155
|
+
- test/prim_test.rb
|
156
|
+
- test/weighted/graph_test.rb
|
157
|
+
- test/weighted/graph_text_factory_test.rb
|