Initial commit
[graph.njae.git] / lib / graph / graph.rb
diff --git a/lib/graph/graph.rb b/lib/graph/graph.rb
new file mode 100644 (file)
index 0000000..c9d83b1
--- /dev/null
@@ -0,0 +1,21 @@
+require 'ostruct'
+
+module Graph
+  class Graph < OpenStruct
+    def initialize
+      super
+      self.edges = Array.new
+      self.vertices = Array.new
+      self
+    end
+    
+    def <<(other)
+      if other.class == Vertex
+        self.vertices << other
+      elsif
+        self.edges << other
+      end
+      self
+    end
+  end
+end