pmelsted / bifrost

Bifrost: Highly parallel construction and indexing of colored and compacted de Bruijn graphs
BSD 2-Clause "Simplified" License
204 stars 25 forks source link

[Q] What is the optimal to get a list of neighbors restricted to a color? #55

Open lrvdijk opened 2 years ago

lrvdijk commented 2 years ago

Hi, quick question: what would be optimal way to get a list of neighbors of a node, restricting to neighbors associated with one or more given colors?

I have an initial implementation here: https://github.com/broadinstitute/pyfrost/blob/b0d6606dc20ef8b692e91df6dfed25dc40f072b5/src/pyfrostcpp/Neighbors.h

Profiling of a tool I'm working showed that it spent most of its time in one of above functions. While this can partly be explained by the fact that we're doing a whole lot of navigating through the graph, any further optimization of this function would be appreciated. And although I think I understand how to access colors and how they're stored, I might be confused and using the API incorrectly.

If you have any optimization suggestions, that would be much appreciated! Thanks!