Class: Ibex::Impact::Propagation
- Inherits:
-
Object
- Object
- Ibex::Impact::Propagation
- Defined in:
- lib/ibex/impact/propagation.rb
Overview
Performs deterministic forward propagation over a dependency graph.
Instance Method Summary collapse
-
#initialize(graph) ⇒ Propagation
constructor
A new instance of Propagation.
- #propagate(seeds, kind = :all, max_depth: nil) ⇒ Object (also: #call)
Constructor Details
#initialize(graph) ⇒ Propagation
Returns a new instance of Propagation.
31 32 33 |
# File 'lib/ibex/impact/propagation.rb', line 31 def initialize(graph) @graph = graph end |
Instance Method Details
#propagate(seeds, kind = :all, max_depth: nil) ⇒ Object Also known as: call
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ibex/impact/propagation.rb', line 36 def propagate(seeds, kind = :all, max_depth: nil) validate_depth(max_depth) selected = normalize_seeds(seeds) adjacency = @graph.adjacency(kind) components = Analysis::Digraph.send(:strongly_connected_components, adjacency) component_for = component_index(components, adjacency.length) component_edges = component_adjacency(adjacency, component_for, components.length) component_nodes = traverse_components(selected, component_for, component_edges, max_depth) witnesses = symbol_witnesses(selected, adjacency, kind) build_nodes(component_nodes, components, kind, witnesses) end |