X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=lib%2Fgraph%2Fgraph.rb;fp=lib%2Fgraph%2Fgraph.rb;h=25c95cc590142f2e55d76723a7a377a0dd8f4038;hb=ae1a87dd7453fbafe86a4d9e5113af7439e5981f;hp=c9d83b16c6d1ea152a36a77caaf38d7318be7ffa;hpb=a4531e10dbf7fb6e199fc9a63dc9bcd329c76d99;p=graph.njae.git diff --git a/lib/graph/graph.rb b/lib/graph/graph.rb index c9d83b1..25c95cc 100644 --- a/lib/graph/graph.rb +++ b/lib/graph/graph.rb @@ -1,6 +1,11 @@ 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 @@ -9,6 +14,7 @@ module Graph self end + # Add a Vertex or Edge to the graph. def <<(other) if other.class == Vertex self.vertices << other