Skip to content

optimize KBestHaplotypeFinder a bit more - #5554

Merged
davidbenjamin merged 1 commit into
masterfrom
db_dijkstra_optimization
Jan 2, 2019
Merged

davidbenjamin merged 1 commit into
masterfrom
db_dijkstra_optimization

Conversation

@davidbenjamin

Copy link
Copy Markdown
Contributor

@takutosato The new KBestHaplotypeFinder algorithm implements the k shortest paths generalization of Dijkstra's algorithm as described in https://en.wikipedia.org/wiki/K_shortest_path_routing. It was, however, missing the condition in the 6th-to-last line if count_u ≤ K, which ignores a vertex if the k best paths through it have already been found. This PR puts in that condition, reducing memory usage.

No need to review before January 2!

@takutosato takutosato left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I speculate that adding an integer member to SeqVertex would be a tiny bit cleaner and faster than using a hashmap of vertices. But you probably already thought of this, and I do see the downside in introducing a new mutable member to the class.

@davidbenjamin

Copy link
Copy Markdown
Contributor Author

I think you're right, but speed is not an issue here and I don't want to touch anything deep in the graph code. . . for now, at least.

@davidbenjamin
davidbenjamin merged commit 0a90562 into master Jan 2, 2019
@davidbenjamin
davidbenjamin deleted the db_dijkstra_optimization branch January 2, 2019 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants