From 0908114d61c0effab6a568dd47053244df92cde8 Mon Sep 17 00:00:00 2001
From: Neil Smith <neil.github@njae.me.uk>
Date: Fri, 23 Sep 2011 16:47:47 +0100
Subject: [PATCH] Changed module name

---
 lib/graph.njae.rb         |  6 ++---
 lib/graph/edge.rb         | 46 ---------------------------------------
 lib/graph/graph.rb        | 27 -----------------------
 lib/graph/vertex.rb       | 41 ----------------------------------
 spec/graph/edge_spec.rb   |  2 +-
 spec/graph/graph_spec.rb  |  2 +-
 spec/graph/vertex_spec.rb |  2 +-
 7 files changed, 6 insertions(+), 120 deletions(-)
 delete mode 100644 lib/graph/edge.rb
 delete mode 100644 lib/graph/graph.rb
 delete mode 100644 lib/graph/vertex.rb

diff --git a/lib/graph.njae.rb b/lib/graph.njae.rb
index f6d4873..b6dad29 100644
--- a/lib/graph.njae.rb
+++ b/lib/graph.njae.rb
@@ -1,3 +1,3 @@
-require 'graph/graph'
-require 'graph/edge'
-require 'graph/vertex'
+require 'graph.njae/graph'
+require 'graph.njae/edge'
+require 'graph.njae/vertex'
diff --git a/lib/graph/edge.rb b/lib/graph/edge.rb
deleted file mode 100644
index e783d35..0000000
--- a/lib/graph/edge.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-require 'ostruct'
-
-# A simple graph library
-
-module Graph
-  
-  # An edge (or multiedge) in a graph. The edge can have arbitrary attributes,
-  # treated as method names.
-  #
-  # Each connection is handled by a Graph::Connection object, so that each end
-  # of the Edge can have it's own attributes.
-  class Edge < OpenStruct
-    def initialize
-      super
-      self.connections = []
-      self
-    end
-    
-    # Connect this edge to a vertex
-    def <<(other)
-      c = Connection.new
-      c.end = other
-      self.connections << c
-      self
-    end
-    
-    # Return the set of vertices this edge connects.
-    def vertices
-      self.connections.map {|c| c.end}
-    end
-    
-    # Return the connection object that joins this Edge to the specified Vertex
-    def connection_at(vertex)
-      self.connections.select {|c| c.end.equal?  vertex}.first
-    end
-  end
-  
-  # A connection between an Edge and a Vertex.The connection can have arbitrary attributes,
-  # treated as method names.
-  class Connection < OpenStruct
-    def initialize
-      super
-      self
-    end
-  end
-end
diff --git a/lib/graph/graph.rb b/lib/graph/graph.rb
deleted file mode 100644
index 25c95cc..0000000
--- a/lib/graph/graph.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-require 'ostruct'
-
-# A simple graph library
-
-module Graph
-  
-  # A container for all the parts of a graph.  The graph can have arbitrary attributes,
-  # treated as method names.
-  class Graph < OpenStruct
-    def initialize
-      super
-      self.edges = Array.new
-      self.vertices = Array.new
-      self
-    end
-    
-    # Add a Vertex or Edge to the graph.
-    def <<(other)
-      if other.class == Vertex
-        self.vertices << other
-      elsif
-        self.edges << other
-      end
-      self
-    end
-  end
-end
diff --git a/lib/graph/vertex.rb b/lib/graph/vertex.rb
deleted file mode 100644
index cb315e7..0000000
--- a/lib/graph/vertex.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-require 'ostruct'
-
-# A simple graph library
-
-module Graph
-  # A vertex in a graph. The edge can have arbitrary attributes,treated as 
-  # method names.
-  class Vertex < OpenStruct
-    def initialize
-      super
-      self.edges = []
-      self
-    end
-    
-    # Connect this vertex to another, creating an Edge to do so, and returning
-    # the Edge
-    def connect(other)
-      e = Edge.new
-      e << self << other
-      self.edges << e
-      other.edges << e unless self === other
-      e
-    end
-    
-    # Connect this vertex to another, creating an Edge to do so, and returning
-    # this Vertex
-    def <<(other)
-      connect(other)
-      self
-    end
-    
-    # Return the set of neighbouring vertices
-    def neighbours
-      vertices = self.edges.map {|e| e.vertices}.flatten
-      vertices_to_me = vertices.select {|v| v == self}
-      other_vertices = vertices.select {|v| v != self}
-      (vertices_to_me[1..-1] || []) + other_vertices
-    end
-    
-  end
-end
diff --git a/spec/graph/edge_spec.rb b/spec/graph/edge_spec.rb
index 8bd1f9a..2e7dbfc 100644
--- a/spec/graph/edge_spec.rb
+++ b/spec/graph/edge_spec.rb
@@ -1,6 +1,6 @@
 require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
 
-module Graph
+module GraphNjae
   describe Edge do
     let (:e) { Edge.new }
     describe "#initialize" do
diff --git a/spec/graph/graph_spec.rb b/spec/graph/graph_spec.rb
index 7227a6f..ba7bea1 100644
--- a/spec/graph/graph_spec.rb
+++ b/spec/graph/graph_spec.rb
@@ -1,6 +1,6 @@
 require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
 
-module Graph
+module GraphNjae
   describe Graph do
     let (:g) { Graph.new }
     describe "#initialize" do
diff --git a/spec/graph/vertex_spec.rb b/spec/graph/vertex_spec.rb
index 637499b..bf2e601 100644
--- a/spec/graph/vertex_spec.rb
+++ b/spec/graph/vertex_spec.rb
@@ -1,6 +1,6 @@
 require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
 
-module Graph
+module GraphNjae
   describe Vertex do
     let (:v) { Vertex.new }
     
-- 
2.43.0