Class: ROOGLI::Graph::Node

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNode



85
86
87
# File 'lib/roogli/graph.rb', line 85

def initialize
	@graph = nil
end

Instance Attribute Details

#graphObject

Returns the value of attribute graph



82
83
84
# File 'lib/roogli/graph.rb', line 82

def graph
  @graph
end

Instance Method Details

#indexObject

The node index (a number between 0 and self.graph.size - 1) for the current graph



90
91
92
# File 'lib/roogli/graph.rb', line 90

def index
	self.graph.nodes.index(self)
end

#to_dot(options = {}) ⇒ Object



94
95
96
97
98
99
# File 'lib/roogli/graph.rb', line 94

def to_dot(options = {})
	options[:label] = "#{self.index}" unless options.include?(:label)

	options = options.map{|k,v| "#{k}=\"#{v}\""}.join(',')
	"#{self.index} [#{options}]"
end