Sha256: 472bcc4fe57190c972a289dd5f5ab95a3eb3b8d1c0cbd8dd0b26f8190cc2f36d
Contents?: true
Size: 609 Bytes
Versions: 4
Compression:
Stored size: 609 Bytes
Contents
# frozen_string_literal: true require 'forwardable' require_relative '../edge' module Tangle module Undirected # # An edge in an undirected graph, connecting two vertices # class Edge < Tangle::Edge def each_vertex(&block) @vertices.each_key(&block) end def to_s vertex1, vertex2 = @vertices.keys "{#{vertex1}<->#{vertex2}}" end alias inspect to_s private def initialize_vertices(vertex1, vertex2 = vertex1) super @vertices = { vertex1 => vertex2, vertex2 => vertex1 }.freeze end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
tangle-0.11.0 | lib/tangle/undirected/edge.rb |
tangle-0.10.2 | lib/tangle/undirected/edge.rb |
tangle-0.10.1 | lib/tangle/undirected/edge.rb |
tangle-0.10.0 | lib/tangle/undirected/edge.rb |