plexus 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/plexus.rb +0 -2
- data/lib/plexus/adjacency_graph.rb +1 -1
- data/lib/plexus/ext.rb +1 -1
- data/lib/plexus/graph.rb +2 -4
- data/lib/plexus/undirected_graph/algorithms.rb +2 -2
- data/lib/plexus/version.rb +1 -1
- metadata +1 -2
- data/lib/plexus/graph_api.rb +0 -35
data/lib/plexus.rb
CHANGED
@@ -4,7 +4,7 @@ module Plexus
|
|
4
4
|
# {DigraphBuilder}, {UndirectedGraphBuilder}, {DirectedPseudoGraphBuilder},
|
5
5
|
# {UndirectedPseudoGraphBuilder}, {DirectedMultiGraphBuilder} and {UndirectedMultiGraphBuilder}
|
6
6
|
# modules, each of them streamlining {AdjacencyGraphBuilder}'s behavior. Those
|
7
|
-
# implementations rely on the {GraphBuilder}
|
7
|
+
# implementations rely on the {GraphBuilder}.
|
8
8
|
module AdjacencyGraphBuilder
|
9
9
|
|
10
10
|
# Defines a useful `push` -> `add` alias for arrays.
|
data/lib/plexus/ext.rb
CHANGED
@@ -28,7 +28,7 @@ class Object
|
|
28
28
|
#
|
29
29
|
# class A; include Digraph; end
|
30
30
|
# a.singleton_class.ancestors
|
31
|
-
# # => [Plexus::
|
31
|
+
# # => [Plexus::DirectedGraph::Algorithms, ...
|
32
32
|
# Plexus::Labels, Enumerable, Object, Plexus, Kernel, BasicObject]
|
33
33
|
# a.is_a? Plexus::Graph
|
34
34
|
# # => true
|
data/lib/plexus/graph.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Plexus
|
2
|
-
# Using
|
3
|
-
#
|
4
|
-
# requested in {GraphAPI}. The process is under the control of the pattern
|
2
|
+
# Using only a basic methods set, it implements all the *basic* functions
|
3
|
+
# of a graph. The process is under the control of the pattern
|
5
4
|
# {AdjacencyGraphBuilder}, unless a specific implementation is specified
|
6
5
|
# during initialization.
|
7
6
|
#
|
@@ -49,7 +48,6 @@ module Plexus
|
|
49
48
|
# These inclusions trigger some validations checks by the way.
|
50
49
|
include(args[:implementation] ? args[:implementation] : Plexus::AdjacencyGraphBuilder)
|
51
50
|
include(args[:algorithmic_category] ? args[:algorithmic_category] : Plexus::DigraphBuilder )
|
52
|
-
include Plexus::GraphAPI
|
53
51
|
end
|
54
52
|
|
55
53
|
implementation_initialize(*params)
|
@@ -20,7 +20,7 @@ module Plexus
|
|
20
20
|
|
21
21
|
def remove_edge!(u, v=nil)
|
22
22
|
unless u.kind_of? Plexus::Arc
|
23
|
-
raise ArgumentError if @parallel_edges
|
23
|
+
raise ArgumentError if @parallel_edges
|
24
24
|
u = edge_class[u,v]
|
25
25
|
end
|
26
26
|
super(u.reverse) unless u.source == u.target
|
@@ -49,7 +49,7 @@ module Plexus
|
|
49
49
|
|
50
50
|
def chromatic_number
|
51
51
|
return triangulated_chromatic_number if triangulated?
|
52
|
-
raise NotImplementedError
|
52
|
+
raise NotImplementedError
|
53
53
|
end
|
54
54
|
|
55
55
|
# An interval graph can have its vertices into one-to-one
|
data/lib/plexus/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: plexus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.5.
|
5
|
+
version: 0.5.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Bruce Williams
|
@@ -95,7 +95,6 @@ files:
|
|
95
95
|
- lib/plexus/directed_graph.rb
|
96
96
|
- lib/plexus/comparability.rb
|
97
97
|
- lib/plexus/chinese_postman.rb
|
98
|
-
- lib/plexus/graph_api.rb
|
99
98
|
- lib/plexus/classes/graph_classes.rb
|
100
99
|
- lib/plexus/strong_components.rb
|
101
100
|
- lib/plexus/support/support.rb
|
data/lib/plexus/graph_api.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
module Plexus
|
2
|
-
# This module defines the minimum set of functions required to make a graph that can
|
3
|
-
# use the algorithms defined by this library.
|
4
|
-
#
|
5
|
-
# Each implementation module must implement the following routines:
|
6
|
-
#
|
7
|
-
# * directed? # Is the graph directed?
|
8
|
-
# * add_vertex!(v,l=nil) # Add a vertex to the graph and return the graph. `l` is an optional label.
|
9
|
-
# * add_edge!(u,v=nil,l=nil) # Add an edge to the graph and return the graph. `u` can be an {Arc} or {Edge}, or `u,v` a {Edge} pair. The last parameter `l` is an optional label.
|
10
|
-
# * remove_vertex!(v) # Remove a vertex to the graph and return the graph.
|
11
|
-
# * remove_edge!(u,v=nil) # Remove an edge from the graph and return the graph.
|
12
|
-
# * vertices # Returns an array of of all vertices.
|
13
|
-
# * edges # Returns an array of all edges.
|
14
|
-
# * edge_class # Returns the class used to store edges.
|
15
|
-
module GraphAPI
|
16
|
-
# @raise if the API is not completely implemented
|
17
|
-
def self.included(klass)
|
18
|
-
@api_methods ||= [:directed?, :add_vertex!, :add_edge!, :remove_vertex!, :remove_edge!, :vertices, :edges, :edge_class]
|
19
|
-
ruby_18 { @api_methods.each { |m| m.to_s } }
|
20
|
-
|
21
|
-
@api_methods.each do |meth|
|
22
|
-
raise "Must implement #{meth}" unless klass.instance_methods.include?(meth)
|
23
|
-
end
|
24
|
-
|
25
|
-
klass.class_eval do
|
26
|
-
# Is this right?
|
27
|
-
alias remove_arc! remove_edge!
|
28
|
-
alias add_arc! add_edge!
|
29
|
-
alias arcs edges
|
30
|
-
alias arc_class edge_class
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
end # GraphAPI
|
35
|
-
end # Plexus
|