Sha256: 18526e098c2cf56313da7318b263503efe1021bdfe0f574dcc1a52c440e1a170

Contents?: true

Size: 301 Bytes

Versions: 2

Compression:

Stored size: 301 Bytes

Contents

class Node
  attr_accessor :neighbours

  def initialize(arg)
    @args = arg
    @neighbours = []
  end

  def degree
    @neighbours.size
  end

  def has_neighbour?(node)
    @neighbours.include?(node)
  end

  def method_missing(name, *args)
    super unless args.empty?
    @args[name]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rgraph-0.0.15 lib/rgraph/node.rb
rgraph-0.0.14 lib/rgraph/node.rb