graphs 0.1.7-x86-linux → 0.1.8-x86-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/graph.rb +1 -1
  2. data/tests/graph_tests.rb +23 -1
  3. metadata +7 -7
@@ -429,7 +429,7 @@ class Graph
429
429
 
430
430
  end
431
431
 
432
- if l1 && l2 == label && self.directed?
432
+ if l1 && l2 == label && !self.directed?
433
433
 
434
434
  n1 = self.get_node l1
435
435
 
@@ -36,6 +36,16 @@ class Graph_test < Test::Unit::TestCase
36
36
  )
37
37
 
38
38
  @@empty = Graph.new
39
+
40
+ @@directed = Graph.new(
41
+ [
42
+ {'label' => 'foo'},
43
+ {'label' => 'bar'}
44
+ ],
45
+ [ { 'node1' => 'foo', 'node2' => 'bar' }]
46
+ )
47
+
48
+ @@directed.attrs[:directed] = true
39
49
  end
40
50
 
41
51
  # == Graph#attrs == #
@@ -588,7 +598,7 @@ class Graph_test < Test::Unit::TestCase
588
598
 
589
599
  end
590
600
 
591
- def test_graph_get_neighbours
601
+ def test_graph_get_neighbours_undirected_graph
592
602
 
593
603
  g = @@sample_graph
594
604
 
@@ -598,4 +608,16 @@ class Graph_test < Test::Unit::TestCase
598
608
 
599
609
  end
600
610
 
611
+ def test_graph_get_neighbours_directed_graph
612
+
613
+ g = @@directed
614
+
615
+ n = g.get_neighbours 'foo'
616
+ assert_equal([ 'bar' ], n.map { |m| m.label })
617
+
618
+ n = g.get_neighbours 'bar'
619
+ assert_equal([], n.map { |m| m.label })
620
+
621
+ end
622
+
601
623
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  prerelease:
6
6
  platform: x86-linux
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-12 00:00:00.000000000 Z
12
+ date: 2013-02-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Provide functions to (un)parse GDF/JSON files and generate graphs
15
15
  email: batifon@yahoo.fr
@@ -20,11 +20,11 @@ files:
20
20
  - lib/graph.rb
21
21
  - lib/graphs/gdf.rb
22
22
  - lib/graphs/json.rb
23
- - tests/tests.rb
24
23
  - tests/graph_tests.rb
25
24
  - tests/edge_tests.rb
26
- - tests/gdf_tests.rb
25
+ - tests/tests.rb
27
26
  - tests/node_tests.rb
27
+ - tests/gdf_tests.rb
28
28
  - tests/gexf_tests.rb
29
29
  - tests/json_tests.rb
30
30
  homepage: https://github.com/bfontaine/Graphs.rb
@@ -48,15 +48,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  version: '0'
49
49
  requirements: []
50
50
  rubyforge_project:
51
- rubygems_version: 1.8.24
51
+ rubygems_version: 1.8.23
52
52
  signing_key:
53
53
  specification_version: 3
54
54
  summary: Utilities to manipulate graph files
55
55
  test_files:
56
- - tests/tests.rb
57
56
  - tests/graph_tests.rb
58
57
  - tests/edge_tests.rb
59
- - tests/gdf_tests.rb
58
+ - tests/tests.rb
60
59
  - tests/node_tests.rb
60
+ - tests/gdf_tests.rb
61
61
  - tests/gexf_tests.rb
62
62
  - tests/json_tests.rb