Class: Turbine::Algorithms::FilteredTarjan

Inherits:
Tarjan
  • Object
show all
Defined in:
lib/turbine/algorithms/filtered_tarjan.rb

Overview

Internal: A wrapper around the Ruby stdlib implementation of Tarjan’s strongly connected components and topological sort algorithms. Restricts the sort to only those edges which match the filter.

Instance Method Summary collapse

Constructor Details

#initialize(graph, &filter) ⇒ FilteredTarjan

Public: Creates a FilteredTarjan instance. If you simply wish to filter by the edge label, the standard Tarjan class will do this with better performance.

graph - A Turbine graph whose nodes are to be sorted. &filter - Block which sleects the edges used to perform the sort.

Returns a FilteredTarjan.



16
17
18
19
# File 'lib/turbine/algorithms/filtered_tarjan.rb', line 16

def initialize(graph, &filter)
  super(graph, nil)
  @filter = filter
end