After some observation I think neversaint want's to find possible combinations DNA-snippets.
That naturally means an upper bound for the length of the DNA, nobody expects a string reaching to the moon. Making the problem much easier to handle with a weighted graph, if he was able to express his task!
Theoretically speaking:
IMHO a really good solution would imply to analyze and (de)compose combinations of graphs. eg:
Subgraph X
\ /
0 - N4 - a - b - N4 - *
all paths from 0 to * will be P(0->a) x P(a->b) x P(b->*), i.e.
combinations of paths thru N4 times paths from a to b thru Subgraph X times N4.¹
As already sketched a BFS should be able to handle your "short-circuit problem" by assigning a simple distance degree to each vertex at a first phase. No big memory problem...
1) IMHO it's not unlikely that DNA-snippets could be clustered in different groups... |