Class: Silicium::Graphs::Graph

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGraph

Returns a new instance of Graph.



8
9
10
# File 'lib/topological_sort.rb', line 8

def initialize
  @nodes = []
end

Instance Attribute Details

#nodesObject

Returns the value of attribute nodes.



6
7
8
# File 'lib/topological_sort.rb', line 6

def nodes
  @nodes
end

Instance Method Details

#add_edge(from, to) ⇒ Object



12
13
14
# File 'lib/topological_sort.rb', line 12

def add_edge(from, to)
  from.adjacents << to
end