Sha256: 93e6e397c46f9f8caeebff4a7ee82bd3abc705ceb1021fe6297c34f78bc0b2c1

Contents?: true

Size: 531 Bytes

Versions: 4

Compression:

Stored size: 531 Bytes

Contents

require 'tangle/edge'

module Tangle
  module Directed
    #
    # An edge in a directed graph
    #
    class Edge < Tangle::Edge
      def initialize(vertex1, vertex2 = vertex1, graph: nil)
        @child, @parent = @vertices = [vertex1, vertex2]
        super
      end

      def parent?(vertex)
        @parent == vertex
      end

      def parent(_vertex = nil)
        @parent
      end

      def child?(vertex)
        @child == vertex
      end

      def child(_vertex = nil)
        @child
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tangle-0.5.1 lib/tangle/directed/edge.rb
tangle-0.5.0 lib/tangle/directed/edge.rb
tangle-0.4.2 lib/tangle/directed/edge.rb
tangle-0.4.0 lib/tangle/directed/edge.rb