Class: Roby::Relations::IncrementalTransitiveClosureVisitor
- Inherits:
-
RGL::DFSVisitor
- Object
- RGL::DFSVisitor
- Roby::Relations::IncrementalTransitiveClosureVisitor
- Defined in:
- lib/roby/relations/incremental_transitive_closure.rb
Overview
Class of visitor used for dfs a graph, in case a vertex is already present in the transitive closure, the path is ignored.
This should be used the the IncrementalTransitiveClosure#discover_vertex to fill unpopulated paths, ignoring those already seen.
Instance Method Summary collapse
- #follow_edge?(source, target) ⇒ Boolean
-
#initialize(graph, transitive_closure) ⇒ IncrementalTransitiveClosureVisitor
constructor
A new instance of IncrementalTransitiveClosureVisitor.
Constructor Details
#initialize(graph, transitive_closure) ⇒ IncrementalTransitiveClosureVisitor
Returns a new instance of IncrementalTransitiveClosureVisitor.
14 15 16 17 18 |
# File 'lib/roby/relations/incremental_transitive_closure.rb', line 14 def initialize(graph, transitive_closure) super(graph) @g = graph @tc = transitive_closure end |
Instance Method Details
#follow_edge?(source, target) ⇒ Boolean
20 21 22 23 24 25 26 |
# File 'lib/roby/relations/incremental_transitive_closure.rb', line 20 def follow_edge?(source, target) has_vertex = @tc.graph.has_vertex?(target) @tc.added_edge(source, target) has_vertex ? false : super(source, target) end |