Class: Silicium::Graphs::Graph
- Inherits:
-
Object
- Object
- Silicium::Graphs::Graph
- Defined in:
- lib/topological_sort.rb
Instance Attribute Summary collapse
-
#nodes ⇒ Object
Returns the value of attribute nodes.
Instance Method Summary collapse
- #add_edge(from, to) ⇒ Object
-
#initialize ⇒ Graph
constructor
A new instance of Graph.
Constructor Details
#initialize ⇒ Graph
Returns a new instance of Graph.
8 9 10 |
# File 'lib/topological_sort.rb', line 8 def initialize @nodes = [] end |
Instance Attribute Details
#nodes ⇒ Object
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 |