X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=lib%2Fgraph.njae%2Fedge.rb;fp=lib%2Fgraph.njae%2Fedge.rb;h=4a1ba790d4f33570f53525cbd3f3c23660135240;hb=369a49ecb7cf80a1d93d7bacc0ef419320295ca1;hp=814360ba818818cd43df1cf0859208d324098c20;hpb=353a5d54ad4014af126c76617d9b02029a3ee98c;p=graph.njae.git

diff --git a/lib/graph.njae/edge.rb b/lib/graph.njae/edge.rb
index 814360b..4a1ba79 100644
--- a/lib/graph.njae/edge.rb
+++ b/lib/graph.njae/edge.rb
@@ -20,6 +20,7 @@ module GraphNjae
     def <<(other)
       c = Connection.new
       c.end = other
+      other.edges << self unless other.edges.include? self
       self.connections << c
       self
     end
@@ -38,8 +39,8 @@ module GraphNjae
   # A connection between an Edge and a Vertex.The connection can have arbitrary attributes,
   # treated as method names.
   class Connection < OpenStruct
-    def initialize
-      super
+    def initialize(values = {})
+      super(values)
       self
     end
   end