jumoku 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/Gemfile +1 -1
  2. data/README.md +12 -12
  3. data/lib/jumoku.rb +2 -2
  4. data/lib/jumoku/builders/raw_tree.rb +4 -4
  5. data/lib/jumoku/builders/tree.rb +5 -5
  6. data/lib/jumoku/support/branch.rb +1 -1
  7. data/lib/jumoku/tree_api.rb +1 -1
  8. data/lib/jumoku/version.rb +1 -1
  9. data/spec/raw_tree_spec.rb +1 -1
  10. data/vendor/git/{graphy → plexus}/CREDITS.md +0 -0
  11. data/vendor/git/plexus/Gemfile +3 -0
  12. data/vendor/git/plexus/Gemfile.lock +28 -0
  13. data/vendor/git/{graphy → plexus}/LICENSE +3 -1
  14. data/vendor/git/plexus/README.md +208 -0
  15. data/vendor/git/plexus/Rakefile +25 -0
  16. data/vendor/git/{graphy → plexus}/TODO.md +1 -1
  17. data/vendor/git/{graphy → plexus}/VERSION +0 -0
  18. data/vendor/git/{graphy → plexus}/examples/graph_self.rb +0 -0
  19. data/vendor/git/{graphy → plexus}/examples/module_graph.jpg +0 -0
  20. data/vendor/git/{graphy → plexus}/examples/module_graph.rb +0 -0
  21. data/vendor/git/{graphy → plexus}/examples/self_graph.jpg +0 -0
  22. data/vendor/git/{graphy → plexus}/examples/visualize.jpg +0 -0
  23. data/vendor/git/{graphy → plexus}/examples/visualize.rb +0 -0
  24. data/vendor/git/plexus/lib/plexus.rb +90 -0
  25. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/adjacency_graph.rb +9 -9
  26. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/arc.rb +16 -22
  27. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/arc_number.rb +2 -2
  28. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/biconnected.rb +2 -2
  29. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/chinese_postman.rb +2 -2
  30. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/classes/graph_classes.rb +10 -10
  31. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/common.rb +6 -6
  32. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/comparability.rb +10 -10
  33. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/directed_graph.rb +15 -13
  34. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/directed_graph/algorithms.rb +21 -18
  35. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/directed_graph/distance.rb +2 -2
  36. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/dot.rb +2 -2
  37. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/edge.rb +8 -9
  38. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/ext.rb +3 -3
  39. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/graph.rb +51 -56
  40. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/graph_api.rb +2 -2
  41. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/labels.rb +8 -8
  42. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/maximum_flow.rb +2 -2
  43. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/ruby_compatibility.rb +0 -0
  44. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/search.rb +43 -44
  45. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/strong_components.rb +4 -4
  46. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/support/support.rb +3 -3
  47. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/undirected_graph.rb +13 -14
  48. data/vendor/git/{graphy/lib/graphy → plexus/lib/plexus}/undirected_graph/algorithms.rb +4 -4
  49. data/vendor/git/plexus/lib/plexus/version.rb +6 -0
  50. data/vendor/git/plexus/plexus.gemspec +24 -0
  51. data/vendor/git/{graphy → plexus}/spec/biconnected_spec.rb +0 -0
  52. data/vendor/git/{graphy → plexus}/spec/chinese_postman_spec.rb +0 -0
  53. data/vendor/git/{graphy → plexus}/spec/community_spec.rb +0 -0
  54. data/vendor/git/{graphy → plexus}/spec/complement_spec.rb +0 -0
  55. data/vendor/git/{graphy → plexus}/spec/digraph_distance_spec.rb +0 -0
  56. data/vendor/git/{graphy → plexus}/spec/digraph_spec.rb +0 -0
  57. data/vendor/git/{graphy → plexus}/spec/dot_spec.rb +0 -0
  58. data/vendor/git/{graphy → plexus}/spec/edge_spec.rb +17 -18
  59. data/vendor/git/{graphy → plexus}/spec/inspection_spec.rb +13 -15
  60. data/vendor/git/{graphy → plexus}/spec/multi_edge_spec.rb +0 -0
  61. data/vendor/git/{graphy → plexus}/spec/neighborhood_spec.rb +3 -5
  62. data/vendor/git/{graphy → plexus}/spec/properties_spec.rb +1 -1
  63. data/vendor/git/{graphy → plexus}/spec/search_spec.rb +45 -45
  64. data/vendor/git/{graphy → plexus}/spec/spec.opts +0 -0
  65. data/vendor/git/{graphy → plexus}/spec/spec_helper.rb +13 -10
  66. data/vendor/git/{graphy → plexus}/spec/strong_components_spec.rb +0 -0
  67. data/vendor/git/{graphy → plexus}/spec/triangulated_spec.rb +1 -1
  68. data/vendor/git/{graphy → plexus}/spec/undirected_graph_spec.rb +0 -0
  69. data/vendor/git/{graphy → plexus}/vendor/priority-queue/CHANGELOG +0 -0
  70. data/vendor/git/{graphy → plexus}/vendor/priority-queue/Makefile +0 -0
  71. data/vendor/git/{graphy → plexus}/vendor/priority-queue/README +0 -0
  72. data/vendor/git/{graphy → plexus}/vendor/priority-queue/benchmark/dijkstra.rb +0 -0
  73. data/vendor/git/{graphy → plexus}/vendor/priority-queue/compare_comments.rb +0 -0
  74. data/vendor/git/{graphy → plexus}/vendor/priority-queue/doc/c-vs-rb.png +0 -0
  75. data/vendor/git/{graphy → plexus}/vendor/priority-queue/doc/compare_big.gp +0 -0
  76. data/vendor/git/{graphy → plexus}/vendor/priority-queue/doc/compare_big.png +0 -0
  77. data/vendor/git/{graphy → plexus}/vendor/priority-queue/doc/compare_small.gp +0 -0
  78. data/vendor/git/{graphy → plexus}/vendor/priority-queue/doc/compare_small.png +0 -0
  79. data/vendor/git/{graphy → plexus}/vendor/priority-queue/doc/results.csv +0 -0
  80. data/vendor/git/{graphy → plexus}/vendor/priority-queue/ext/priority_queue/CPriorityQueue/extconf.rb +0 -0
  81. data/vendor/git/{graphy → plexus}/vendor/priority-queue/ext/priority_queue/CPriorityQueue/priority_queue.c +0 -0
  82. data/vendor/git/{graphy → plexus}/vendor/priority-queue/lib/priority_queue.rb +0 -0
  83. data/vendor/git/{graphy → plexus}/vendor/priority-queue/lib/priority_queue/c_priority_queue.rb +0 -0
  84. data/vendor/git/{graphy → plexus}/vendor/priority-queue/lib/priority_queue/poor_priority_queue.rb +0 -0
  85. data/vendor/git/{graphy → plexus}/vendor/priority-queue/lib/priority_queue/ruby_priority_queue.rb +0 -0
  86. data/vendor/git/{graphy → plexus}/vendor/priority-queue/priority_queue.so +0 -0
  87. data/vendor/git/{graphy → plexus}/vendor/priority-queue/setup.rb +0 -0
  88. data/vendor/git/{graphy → plexus}/vendor/priority-queue/test/priority_queue_test.rb +0 -0
  89. data/vendor/git/{graphy → plexus}/vendor/rdot.rb +0 -0
  90. metadata +81 -78
  91. data/vendor/git/graphy/README.md +0 -186
  92. data/vendor/git/graphy/Rakefile +0 -61
  93. data/vendor/git/graphy/graphy.gemspec +0 -149
  94. data/vendor/git/graphy/lib/graphy.rb +0 -90
@@ -0,0 +1,25 @@
1
+ # encoding: UTF-8
2
+ require 'rubygems'
3
+ begin
4
+ require 'bundler/setup'
5
+ rescue LoadError
6
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
7
+ end
8
+
9
+ require 'rake'
10
+ require 'rake/rdoctask'
11
+
12
+ require 'rspec/core'
13
+ require 'rspec/core/rake_task'
14
+
15
+ RSpec::Core::RakeTask.new(:spec)
16
+
17
+ task :default => :spec
18
+
19
+ Rake::RDocTask.new(:rdoc) do |rdoc|
20
+ rdoc.rdoc_dir = 'rdoc'
21
+ rdoc.title = 'Plexus'
22
+ rdoc.options << '--line-numbers' << '--inline-source'
23
+ rdoc.rdoc_files.include('README.rdoc')
24
+ rdoc.rdoc_files.include('lib/**/*.rb')
25
+ end
@@ -14,7 +14,7 @@
14
14
  The following list was present in GRATR, and items may (or may not) be added to this library:
15
15
 
16
16
  * Primal Dual for combinatorial optimization problems
17
- * Min-Max Flow
17
+ * Min-Max Flow
18
18
  * Near optimal traveling salesman problem
19
19
  * Orientation of undirected graphs
20
20
  * Undirected graphs from ActiveRecord
File without changes
@@ -0,0 +1,90 @@
1
+ #--
2
+ # Copyright (c) 2006 Shawn Patrick Garbett
3
+ # Copyright (c) 2002,2004,2005 by Horst Duchene
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without modification,
6
+ # are permitted provided that the following conditions are met:
7
+ #
8
+ # * Redistributions of source code must retain the above copyright notice(s),
9
+ # this list of conditions and the following disclaimer.
10
+ # * Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ # * Neither the name of the Shawn Garbett nor the names of its contributors
14
+ # may be used to endorse or promote products derived from this software
15
+ # without specific prior written permission.
16
+ #
17
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
21
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ #++
28
+
29
+ require 'set'
30
+
31
+ module Plexus
32
+ # Plexus internals: graph builders and additionnal behaviors
33
+ autoload :GraphAPI, 'plexus/graph_api'
34
+
35
+ autoload :GraphBuilder, 'plexus/graph'
36
+ autoload :AdjacencyGraphBuilder, 'plexus/adjacency_graph'
37
+
38
+ autoload :DirectedGraphBuilder, 'plexus/directed_graph'
39
+ autoload :DigraphBuilder, 'plexus/directed_graph'
40
+ autoload :DirectedPseudoGraphBuilder, 'plexus/directed_graph'
41
+ autoload :DirectedMultiGraphBuilder, 'plexus/directed_graph'
42
+
43
+ autoload :UndirectedGraphBuilder, 'plexus/undirected_graph'
44
+ autoload :UndirectedPseudoGraphBuilder, 'plexus/undirected_graph'
45
+ autoload :UndirectedMultiGraphBuilder, 'plexus/undirected_graph'
46
+
47
+ autoload :Arc, 'plexus/arc'
48
+ autoload :ArcNumber, 'plexus/arc_number'
49
+ autoload :Biconnected, 'plexus/biconnected'
50
+ autoload :ChinesePostman, 'plexus/chinese_postman'
51
+ autoload :Common, 'plexus/common'
52
+ autoload :Comparability, 'plexus/comparability'
53
+
54
+ autoload :Dot, 'plexus/dot'
55
+ autoload :Edge, 'plexus/edge'
56
+ autoload :Labels, 'plexus/labels'
57
+ autoload :MaximumFlow, 'plexus/maximum_flow'
58
+ #autoload :Rdot, 'plexus/dot'
59
+ autoload :Search, 'plexus/search'
60
+ autoload :StrongComponents, 'plexus/strong_components'
61
+
62
+ # Plexus classes
63
+ autoload :AdjacencyGraph, 'plexus/classes/graph_classes'
64
+ autoload :DirectedGraph, 'plexus/classes/graph_classes'
65
+ autoload :Digraph, 'plexus/classes/graph_classes'
66
+ autoload :DirectedPseudoGraph, 'plexus/classes/graph_classes'
67
+ autoload :DirectedMultiGraph, 'plexus/classes/graph_classes'
68
+ autoload :UndirectedGraph, 'plexus/classes/graph_classes'
69
+ autoload :UndirectedPseudoGraph, 'plexus/classes/graph_classes'
70
+ autoload :UndirectedMultiGraph, 'plexus/classes/graph_classes'
71
+
72
+ # ruby stdlib extensions
73
+ require 'plexus/ext'
74
+ # ruby 1.8.x/1.9.x compatibility
75
+ require 'plexus/ruby_compatibility'
76
+ end
77
+
78
+ # Vendored libraries
79
+
80
+ require 'pathname'
81
+ path = Pathname.new(__FILE__)
82
+ $LOAD_PATH.unshift(path + '../../vendor') # http://ruby.brian-amberg.de/priority-queue/
83
+ $LOAD_PATH.unshift(path + '../../vendor/priority-queue/lib')
84
+
85
+ require 'rdot'
86
+ require 'facets/hash'
87
+
88
+ require 'priority_queue/ruby_priority_queue'
89
+ PriorityQueue = RubyPriorityQueue
90
+
@@ -1,4 +1,4 @@
1
- module Graphy
1
+ module Plexus
2
2
 
3
3
  # This module provides the basic routines needed to implement the specialized builders:
4
4
  # {DigraphBuilder}, {UndirectedGraphBuilder}, {DirectedPseudoGraphBuilder},
@@ -42,7 +42,7 @@ module Graphy
42
42
  end
43
43
 
44
44
  # Copy any given graph into this graph.
45
- params.select { |p| p.is_a? Graphy::GraphBuilder }.each do |g|
45
+ params.select { |p| p.is_a? Plexus::GraphBuilder }.each do |g|
46
46
  g.edges.each do |e|
47
47
  add_edge!(e)
48
48
  edge_label_set(e, edge_label(e)) if edge_label(e)
@@ -75,7 +75,7 @@ module Graphy
75
75
  # @param [vertex] v (nil)
76
76
  # @return [Boolean]
77
77
  def edge?(u, v = nil)
78
- u, v = u.source, u.target if u.is_a? Graphy::Arc
78
+ u, v = u.source, u.target if u.is_a? Plexus::Arc
79
79
  vertex?(u) and @vertex_dict[u].include?(v)
80
80
  end
81
81
 
@@ -106,7 +106,7 @@ module Graphy
106
106
  # @return [AdjacencyGraph] `self`
107
107
  def add_edge!(u, v = nil, l = nil, n = nil)
108
108
  n = u.number if u.class.include? ArcNumber and n.nil?
109
- u, v, l = u.source, u.target, u.label if u.is_a? Graphy::Arc
109
+ u, v, l = u.source, u.target, u.label if u.is_a? Plexus::Arc
110
110
 
111
111
  return self if not @allow_loops and u == v
112
112
 
@@ -144,10 +144,10 @@ module Graphy
144
144
  # Removes an edge from the graph.
145
145
  #
146
146
  # Can be called with both source and target as vertex,
147
- # or with source and object of {Graphy::Arc} derivation.
147
+ # or with source and object of {Plexus::Arc} derivation.
148
148
  #
149
149
  # @overload remove_edge!(a)
150
- # @param [Graphy::Arc] a
150
+ # @param [Plexus::Arc] a
151
151
  # @return [AdjacencyGraph] `self`
152
152
  # @raise [ArgumentError] if parallel edges are enabled
153
153
  # @overload remove_edge!(u, v)
@@ -156,7 +156,7 @@ module Graphy
156
156
  # @return [AdjacencyGraph] `self`
157
157
  # @raise [ArgumentError] if parallel edges are enabled and the {ArcNumber} of `u` is zero
158
158
  def remove_edge!(u, v = nil)
159
- unless u.is_a? Graphy::Arc
159
+ unless u.is_a? Plexus::Arc
160
160
  raise ArgumentError if @parallel_edges
161
161
  u = edge_class[u,v]
162
162
  end
@@ -206,7 +206,7 @@ module Graphy
206
206
  # @fixme
207
207
  def adjacent(x, options = {})
208
208
  options[:direction] ||= :out
209
- if !x.is_a?(Graphy::Arc) and (options[:direction] == :out || !directed?)
209
+ if !x.is_a?(Plexus::Arc) and (options[:direction] == :out || !directed?)
210
210
  if options[:type] == :edges
211
211
  i = -1
212
212
  @parallel_edges ?
@@ -221,4 +221,4 @@ module Graphy
221
221
  end
222
222
 
223
223
  end # Adjacency Graph
224
- end # Graphy
224
+ end # Plexus
@@ -1,14 +1,12 @@
1
- module Graphy
2
-
1
+ module Plexus
3
2
  # Arc includes classes for representing egdes of directed and
4
3
  # undirected graphs. There is no need for a Vertex class, because any ruby
5
4
  # object can be a vertex of a graph.
6
5
  #
7
- # Arc's base is a Struct with a :source, a :target and a :label
6
+ # Arc's base is a Struct with a :source, a :target and a :label.
8
7
  Struct.new("ArcBase", :source, :target, :label)
9
8
 
10
9
  class Arc < Struct::ArcBase
11
-
12
10
  def initialize(p_source, p_target, p_label = nil)
13
11
  super(p_source, p_target, p_label)
14
12
  end
@@ -20,7 +18,9 @@ module Graphy
20
18
  alias == eql?
21
19
 
22
20
  # Returns (v,u) if self == (u,v).
23
- def reverse() self.class.new(target, source, label); end
21
+ def reverse()
22
+ self.class.new(target, source, label)
23
+ end
24
24
 
25
25
  # Sort support.
26
26
  def <=>(rhs)
@@ -32,18 +32,14 @@ module Graphy
32
32
  l = label ? " '#{label.to_s}'" : ''
33
33
  "(#{source}-#{target}#{l})"
34
34
  end
35
-
35
+
36
36
  # Hash is defined in such a way that label is not
37
37
  # part of the hash value
38
38
  # FIXME: I had to get rid of that in order to make to_dot_graph
39
39
  # work, but I can't figure it out (doesn't show up in the stack!)
40
- #def hash
41
- #puts "--- #{caller}"
42
- ##puts source.inspect
43
- ##puts target.inspect
44
- #source.hash ^ (target.hash + 1)
45
- #puts "---"
46
- #end
40
+ def hash
41
+ source.hash ^ (target.hash + 1)
42
+ end
47
43
 
48
44
  # Shortcut constructor.
49
45
  #
@@ -51,15 +47,13 @@ module Graphy
51
47
  def self.[](p_source, p_target, p_label = nil)
52
48
  new(p_source, p_target, p_label)
53
49
  end
54
-
55
- #def inspect
56
- #"#{self.class.to_s}[#{source.inspect},#{target.inspect},#{label.inspect}]"
57
- #end
58
-
59
- end # Arc
60
-
50
+
51
+ def inspect
52
+ "#{self.class.to_s}[#{source.inspect},#{target.inspect},#{label.inspect}]"
53
+ end
54
+ end
55
+
61
56
  class MultiArc < Arc
62
57
  include ArcNumber
63
58
  end
64
-
65
- end # Graphy
59
+ end
@@ -1,4 +1,4 @@
1
- module Graphy
1
+ module Plexus
2
2
  # This module handles internal numbering of edges in order to differente between mutliple edges.
3
3
  module ArcNumber
4
4
 
@@ -49,4 +49,4 @@ module Graphy
49
49
  end
50
50
 
51
51
  end # ArcNumber
52
- end # Graphy
52
+ end # Plexus
@@ -1,4 +1,4 @@
1
- module Graphy
1
+ module Plexus
2
2
 
3
3
  # Biconnected is a module for adding the biconnected algorithm to
4
4
  # UndirectedGraphs
@@ -81,4 +81,4 @@ module Graphy
81
81
  end # biconnected
82
82
 
83
83
  end # Biconnected
84
- end # Graphy
84
+ end # Plexus
@@ -1,4 +1,4 @@
1
- module Graphy
1
+ module Plexus
2
2
  module ChinesePostman
3
3
 
4
4
  # Returns the shortest walk that traverses all arcs at least
@@ -87,5 +87,5 @@ module Graphy
87
87
  end
88
88
 
89
89
  end # Chinese Postman
90
- end # Graphy
90
+ end # Plexus
91
91
 
@@ -1,28 +1,28 @@
1
- module Graphy
1
+ module Plexus
2
2
  # A generic {GraphBuilder Graph} class you can inherit from.
3
- class Graph; include GraphBuilder; end
3
+ class Graph; include GraphBuilder; end
4
4
 
5
5
  # A generic {AdjacencyGraphBuilder AdjacencyGraph} class you can inherit from.
6
- class AdjacencyGraph; include AdjacencyGraphBuilder; end
6
+ class AdjacencyGraph < Graph; include AdjacencyGraphBuilder; end
7
7
 
8
8
  # A generic {DirectedGraphBuilder DirectedGraph} class you can inherit from.
9
- class DirectedGraph; include DirectedGraphBuilder; end
9
+ class DirectedGraph < Graph; include DirectedGraphBuilder; end
10
10
 
11
11
  # A generic {DigraphBuilder Digraph} class you can inherit from.
12
- class Digraph; include DigraphBuilder; end
12
+ class Digraph < Graph; include DigraphBuilder; end
13
13
 
14
14
  # A generic {DirectedPseudoGraphBuilder DirectedPseudoGraph} class you can inherit from.
15
- class DirectedPseudoGraph; include DirectedPseudoGraphBuilder; end
15
+ class DirectedPseudoGraph < Graph; include DirectedPseudoGraphBuilder; end
16
16
 
17
17
  # A generic {DirectedMultiGraphBuilder DirectedMultiGraph} class you can inherit from.
18
- class DirectedMultiGraph; include DirectedMultiGraphBuilder; end
18
+ class DirectedMultiGraph < Graph; include DirectedMultiGraphBuilder; end
19
19
 
20
20
  # A generic {UndirectedGraphBuilder UndirectedGraph} class you can inherit from.
21
- class UndirectedGraph; include UndirectedGraphBuilder; end
21
+ class UndirectedGraph < Graph; include UndirectedGraphBuilder; end
22
22
 
23
23
  # A generic {UndirectedPseudoGraphBuilder UndirectedPseudoGraph} class you can inherit from.
24
- class UndirectedPseudoGraph; include UndirectedPseudoGraphBuilder; end
24
+ class UndirectedPseudoGraph < Graph; include UndirectedPseudoGraphBuilder; end
25
25
 
26
26
  # A generic {UndirectedMultiGraphBuilder UndirectedMultiGraph} class you can inherit from.
27
- class UndirectedMultiGraph; include UndirectedMultiGraphBuilder; end
27
+ class UndirectedMultiGraph < Graph; include UndirectedMultiGraphBuilder; end
28
28
  end
@@ -1,4 +1,4 @@
1
- module Graphy
1
+ module Plexus
2
2
 
3
3
  # This class defines a cycle graph of size n.
4
4
  # This is easily done by using the base Graph
@@ -23,12 +23,12 @@ module Graphy
23
23
  end
24
24
 
25
25
  def edge?(u,v = nil)
26
- u, v = [u.source, v.target] if u.is_a? Graphy::Arc
26
+ u, v = [u.source, v.target] if u.is_a? Plexus::Arc
27
27
  vertex?(u) && vertex?(v) && ((v-u == 1) or (u == @size && v = 1))
28
28
  end
29
29
 
30
30
  def edges
31
- Array.new(@size) { |i| Graphy::Edge[i+1, (i+1) == @size ? 1 : i+2]}
31
+ Array.new(@size) { |i| Plexus::Edge[i+1, (i+1) == @size ? 1 : i+2]}
32
32
  end
33
33
  end # CycleBuilder
34
34
 
@@ -49,15 +49,15 @@ module Graphy
49
49
  return @edges if @edges # cache edges
50
50
  @edges = []
51
51
  @size.times do |u|
52
- @size.times { |v| @edges << Graphy::Edge[u+1, v+1]}
52
+ @size.times { |v| @edges << Plexus::Edge[u+1, v+1]}
53
53
  end
54
54
  @edges
55
55
  end
56
56
 
57
57
  def edge?(u, v = nil)
58
- u, v = [u.source, v.target] if u.kind_of? Graphy::Arc
58
+ u, v = [u.source, v.target] if u.kind_of? Plexus::Arc
59
59
  vertex?(u) && vertex?(v)
60
60
  end
61
61
  end # CompleteBuilder
62
62
 
63
- end # Graphy
63
+ end # Plexus
@@ -1,4 +1,4 @@
1
- module Graphy
1
+ module Plexus
2
2
  module Comparability
3
3
 
4
4
  # A comparability graph is an UndirectedGraph that has a transitive
@@ -19,7 +19,7 @@ module Graphy
19
19
  if classification[e].nil?
20
20
  k += 1
21
21
  classification[e] = k; classification[e.reverse] = -k
22
- comparability &&= graphy_comparability_explore(e, k, classification)
22
+ comparability &&= plexus_comparability_explore(e, k, classification)
23
23
  end
24
24
  end; [classification, comparability]
25
25
  end
@@ -34,12 +34,12 @@ module Graphy
34
34
 
35
35
  # Taken from Figure 5.10, on pg. 130 of Martin Golumbic's, _Algorithmic_Graph_
36
36
  # _Theory_and_Perfect_Graphs.
37
- def graphy_comparability_explore(edge, k, classification, space='')
38
- ret = graphy_comparability_explore_inner(edge, k, classification, :forward, space)
39
- graphy_comparability_explore_inner(edge.reverse, k, classification, :backward, space) && ret
37
+ def plexus_comparability_explore(edge, k, classification, space='')
38
+ ret = plexus_comparability_explore_inner(edge, k, classification, :forward, space)
39
+ plexus_comparability_explore_inner(edge.reverse, k, classification, :backward, space) && ret
40
40
  end
41
41
 
42
- def graphy_comparability_explore_inner(edge, k, classification, direction,space)
42
+ def plexus_comparability_explore_inner(edge, k, classification, direction,space)
43
43
  comparability = true
44
44
  adj_target = adjacent(edge[1])
45
45
  adjacent(edge[0]).select do |mt|
@@ -50,14 +50,14 @@ module Graphy
50
50
  if classification[e].nil?
51
51
  classification[e] = k
52
52
  classification[e.reverse] = -k
53
- comparability = graphy_comparability_explore(e, k, classification, ' '+space) && comparability
53
+ comparability = plexus_comparability_explore(e, k, classification, ' '+space) && comparability
54
54
  elsif classification[e] == -k
55
55
  classification[e] = k
56
- graphy_comparability_explore(e, k, classification, ' '+space)
56
+ plexus_comparability_explore(e, k, classification, ' '+space)
57
57
  comparability = false
58
58
  end
59
59
  end; comparability
60
- end # graphy_comparability_explore_inner
60
+ end # plexus_comparability_explore_inner
61
61
 
62
62
  end # Comparability
63
- end # Graphy
63
+ end # Plexus