Class: Graphviz::Edge

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

Overview

Represents a visual edge between two nodes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(graph, source, destination, attributes = {}) ⇒ Edge

Initialize the edge in the given graph, with a source and destination node.

Parameters:

  • attributes (Hash) (defaults to: {})

    The associated graphviz attributes for this edge.



110
111
112
113
114
115
116
117
118
# File 'lib/graphviz/graph.rb', line 110

def initialize(graph, source, destination, attributes = {})
	@graph = graph
	@graph.edges << self
	
	@source = source
	@destination = destination
	
	@attributes = attributes
end

Instance Attribute Details

#attributesHash

Returns Any attributes specified for this edge.

Returns:

  • (Hash)

    Any attributes specified for this edge.



127
128
129
# File 'lib/graphviz/graph.rb', line 127

def attributes
  @attributes
end

#destinationNode (readonly)

Returns The destination node.

Returns:

  • (Node)

    The destination node.



124
125
126
# File 'lib/graphviz/graph.rb', line 124

def destination
  @destination
end

#sourceNode (readonly)

Returns The source node.

Returns:

  • (Node)

    The source node.



121
122
123
# File 'lib/graphviz/graph.rb', line 121

def source
  @source
end

Instance Method Details

#to_sString

Returns A convenient ASCII arrow.

Returns:

  • (String)

    A convenient ASCII arrow.



130
131
132
# File 'lib/graphviz/graph.rb', line 130

def to_s
	'->'
end