Class: Bio::AssemblyGraphAlgorithms::SingleCoherentPathsBetweenNodesFinder::ProblemTrailFinder
- Inherits:
-
Object
- Object
- Bio::AssemblyGraphAlgorithms::SingleCoherentPathsBetweenNodesFinder::ProblemTrailFinder
- Includes:
- FinishM::Logging
- Defined in:
- lib/assembly/single_coherent_paths_between_nodes.rb
Instance Method Summary collapse
- #dequeue ⇒ Object
-
#initialize(graph, initial_path) ⇒ ProblemTrailFinder
constructor
A new instance of ProblemTrailFinder.
- #length ⇒ Object
- #push_next_neighbours(current_path) ⇒ Object
Methods included from FinishM::Logging
Constructor Details
#initialize(graph, initial_path) ⇒ ProblemTrailFinder
Returns a new instance of ProblemTrailFinder.
505 506 507 508 509 |
# File 'lib/assembly/single_coherent_paths_between_nodes.rb', line 505 def initialize(graph, initial_path) @graph = graph @pqueue = DS::AnyPriorityQueue.new {|a,b| a < b} @pqueue.enqueue initial_path.copy, 0 end |
Instance Method Details
#dequeue ⇒ Object
511 512 513 |
# File 'lib/assembly/single_coherent_paths_between_nodes.rb', line 511 def dequeue @pqueue.dequeue end |
#length ⇒ Object
515 516 517 |
# File 'lib/assembly/single_coherent_paths_between_nodes.rb', line 515 def length @pqueue.length end |
#push_next_neighbours(current_path) ⇒ Object
519 520 521 522 523 524 525 526 527 528 529 |
# File 'lib/assembly/single_coherent_paths_between_nodes.rb', line 519 def push_next_neighbours(current_path) next_nodes = current_path.neighbours_of_last_node(@graph) log.debug "Pushing #{next_nodes.length} new neighbours of #{current_path.last}" if log.debug? #TODO: not neccessary to copy all paths, can just continue one of them next_nodes.each do |n| log.debug "Pushing neighbour to stack: #{n}" if log.debug? path = current_path.copy path.add_oriented_node n @pqueue.enqueue path, path.length_in_bp end end |