find_communities 0.0.3 → 0.0.4
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/bin/community +4 -2
- data/bin/convert +23 -0
- data/lib/find_communities/binary_graph.rb +20 -6
- data/lib/find_communities/community.rb +5 -2
- data/lib/find_communities/graph.rb +94 -14
- data/lib/find_communities/version.rb +1 -1
- data/lib/find_communities/weights_record.rb +9 -0
- data/spec/bin/community_spec.rb +37 -5
- data/spec/bin/convert_spec.rb +48 -0
- data/spec/data/dense_weighted_graph.bin +0 -0
- data/spec/data/dense_weighted_graph.txt +9243 -0
- data/spec/data/dense_weighted_graph.weights +0 -0
- data/spec/data/karate.weights +0 -0
- data/spec/lib/binary_graph_spec.rb +0 -1
- data/spec/lib/community_spec.rb +0 -1
- data/spec/lib/graph_spec.rb +22 -0
- data/spec/spec_helper.rb +1 -0
- metadata +18 -3
Binary file
|
Binary file
|
data/spec/lib/community_spec.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Graph do
|
4
|
+
let(:filename) { File.dirname(__FILE__) + "/../data/dense_weighted_graph.txt" }
|
5
|
+
let(:control_file) { File.dirname(__FILE__) + "/../data/dense_weighted_graph.bin" }
|
6
|
+
let(:control_weights_file) { File.dirname(__FILE__) + "/../data/dense_weighted_graph.weights" }
|
7
|
+
|
8
|
+
it "can read a file and create a binary graph" do
|
9
|
+
g = Graph.new(filename, :weighted)
|
10
|
+
g.clean
|
11
|
+
new_bg = g.to_binary_graph
|
12
|
+
control_bg = BinaryGraph.new(control_file, control_weights_file)
|
13
|
+
new_bg.nb_nodes.should == control_bg.nb_nodes
|
14
|
+
new_bg.nb_links.should == control_bg.nb_links
|
15
|
+
new_bg.degrees.should =~ control_bg.degrees
|
16
|
+
new_bg.total_weight.should == control_bg.total_weight
|
17
|
+
new_bg.links.should =~ control_bg.links
|
18
|
+
new_bg.weights.should =~ control_bg.weights
|
19
|
+
[control_bg, new_bg].each { |bg| bg.stub(:print) }
|
20
|
+
new_bg.display_graph.should == control_bg.display_graph
|
21
|
+
end
|
22
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: find_communities
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabe Kopley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bindata
|
@@ -43,6 +43,7 @@ email:
|
|
43
43
|
- gabe@coshx.com
|
44
44
|
executables:
|
45
45
|
- community
|
46
|
+
- convert
|
46
47
|
extensions: []
|
47
48
|
extra_rdoc_files: []
|
48
49
|
files:
|
@@ -52,6 +53,7 @@ files:
|
|
52
53
|
- README.md
|
53
54
|
- Rakefile
|
54
55
|
- bin/community
|
56
|
+
- bin/convert
|
55
57
|
- find_communities.gemspec
|
56
58
|
- lib/find_communities.rb
|
57
59
|
- lib/find_communities/binary_graph.rb
|
@@ -59,12 +61,19 @@ files:
|
|
59
61
|
- lib/find_communities/community.rb
|
60
62
|
- lib/find_communities/graph.rb
|
61
63
|
- lib/find_communities/version.rb
|
64
|
+
- lib/find_communities/weights_record.rb
|
62
65
|
- spec/bin/community_spec.rb
|
66
|
+
- spec/bin/convert_spec.rb
|
67
|
+
- spec/data/dense_weighted_graph.bin
|
68
|
+
- spec/data/dense_weighted_graph.txt
|
69
|
+
- spec/data/dense_weighted_graph.weights
|
63
70
|
- spec/data/karate.bin
|
64
71
|
- spec/data/karate.tree
|
72
|
+
- spec/data/karate.weights
|
65
73
|
- spec/helpers.rb
|
66
74
|
- spec/lib/binary_graph_spec.rb
|
67
75
|
- spec/lib/community_spec.rb
|
76
|
+
- spec/lib/graph_spec.rb
|
68
77
|
- spec/spec_helper.rb
|
69
78
|
homepage: https://github.com/gkop/find_communities-ruby
|
70
79
|
licenses:
|
@@ -86,15 +95,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
95
|
version: '0'
|
87
96
|
requirements: []
|
88
97
|
rubyforge_project:
|
89
|
-
rubygems_version: 2.0.
|
98
|
+
rubygems_version: 2.0.3
|
90
99
|
signing_key:
|
91
100
|
specification_version: 4
|
92
101
|
summary: Ruby implementation of Louvain community detection method
|
93
102
|
test_files:
|
94
103
|
- spec/bin/community_spec.rb
|
104
|
+
- spec/bin/convert_spec.rb
|
105
|
+
- spec/data/dense_weighted_graph.bin
|
106
|
+
- spec/data/dense_weighted_graph.txt
|
107
|
+
- spec/data/dense_weighted_graph.weights
|
95
108
|
- spec/data/karate.bin
|
96
109
|
- spec/data/karate.tree
|
110
|
+
- spec/data/karate.weights
|
97
111
|
- spec/helpers.rb
|
98
112
|
- spec/lib/binary_graph_spec.rb
|
99
113
|
- spec/lib/community_spec.rb
|
114
|
+
- spec/lib/graph_spec.rb
|
100
115
|
- spec/spec_helper.rb
|