Module: Jumoku::Strategies::EdgeLabelingBackend
- Included in:
- SimpleEdgeLabeling
- Defined in:
- lib/jumoku/strategies/edge_labeling.rb
Overview
Edge labeling strategies are concerned with the way edges or arcs are labeled. Simple labeling schemes are based on indexing with increasing integers, whereas some other strategies elaborate on notions such as weight or symetry.
This module provides basic implementation for the common ground used by custom strategies.
Instance Method Summary collapse
-
#sorted_edges(&block) ⇒ Array
Sort edges by the provided block’s logic.
Instance Method Details
#sorted_edges(&block) ⇒ Array
Sort edges by the provided block’s logic. The block takes edge as parameter, and this method delegates to Enumerable#sort_by for sorting edges. Return unsorted edges list if no block is provided.
18 19 20 21 |
# File 'lib/jumoku/strategies/edge_labeling.rb', line 18 def sorted_edges(&block) return edges.sort_by { |edge| block.call(edge) } if block_given? edges end |