Sha256: 74a27f2d0b5672f32eae81a5ef47d05640ba67fa7ef507ecf503c24fa8efaba3
Contents?: true
Size: 350 Bytes
Versions: 1
Compression:
Stored size: 350 Bytes
Contents
class Graph::Edge attr_reader :key, :graph, :from, :to attr_accessor :weight def initialize(from, to, weight: 1) @from = from @to = to @key = "from_#{from.key}_to_#{to.key}" @weight = weight end def to_h { from: from.key, to: to.key, weight: weight } end private def add_to(graph) @graph = graph end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
graph-rb-0.1.1 | lib/graph/edge.rb |