module Connected::Vertex

Vertices are based on a mixin

Public Instance Methods

connection_to(other) click to toggle source

Retrieves the Connection object responsible for connecting to a Node

# File lib/connected/vertex.rb, line 17
def connection_to(other)
  connections.select { |c| c.to == other }.min_by(&:metric)
end
connections() click to toggle source
# File lib/connected/vertex.rb, line 6
def connections
  # Expect classes to describe how to find connections
  raise "#connections() MUST be implemented on #{self.class.name}"
end
neighbors() click to toggle source

A shortcut for retrieving this node's neighbors

# File lib/connected/vertex.rb, line 12
def neighbors
  connections.map(&:to).uniq
end