We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
anyone else ever attempted to make shortest_path_between fast?
shortest_path_between
https://github.com/payrollhero/acts-as-dag/blob/master/lib/dag/edges.rb#L88-L108
#Finds the shortest path between ancestor and descendant returning as an array def shortest_path_between(ancestor, descendant, path=[]) shortest = [] ancestor.children.each do |child| if child == descendant temp = path.clone temp << child if shortest.blank? || temp.length < shortest.length shortest = temp end elsif self.find_link(child, descendant) temp = path.clone temp << child temp = self.shortest_path_between(child, descendant, temp) if shortest.blank? || temp.length < shortest.length shortest = temp end end end return shortest end
The text was updated successfully, but these errors were encountered:
No branches or pull requests
anyone else ever attempted to make
shortest_path_between
fast?https://github.com/payrollhero/acts-as-dag/blob/master/lib/dag/edges.rb#L88-L108
The text was updated successfully, but these errors were encountered: