Class: ValueGraphTransformation::Graph::Edge

Inherits:
Object
  • Object
show all
Defined in:
lib/value_graph_transformation/graph/edge.rb

Overview

A directed edge between two vertices.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Edge) initialize(source, target)

Returns a new instance of Edge

Parameters:

  • source (Vertex)

    the source vertex

  • target (Vertex)

    the target vertex



14
15
16
17
18
19
# File 'lib/value_graph_transformation/graph/edge.rb', line 14

def initialize(source, target)
  fail "source '#{source.to_s}' is not a Vertex" unless source.is_a?(Vertex)
  fail "target '#{target.to_s}' is not a Vertex" unless target.is_a?(Vertex)
  @source = source
  @target = target
end

Instance Attribute Details

- (Vertex) source

Returns the source vertex.

Returns:

  • (Vertex)

    the source vertex.



7
8
9
# File 'lib/value_graph_transformation/graph/edge.rb', line 7

def source
  @source
end

- (Vertex) target

Returns the target vertex.

Returns:

  • (Vertex)

    the target vertex.



10
11
12
# File 'lib/value_graph_transformation/graph/edge.rb', line 10

def target
  @target
end