Skip to content

algorithm: Fix non-starting-node loops#21

Merged
s-heppner merged 1 commit intomainfrom
Fix/non-starting-node-loops
Dec 10, 2025
Merged

algorithm: Fix non-starting-node loops#21
s-heppner merged 1 commit intomainfrom
Fix/non-starting-node-loops

Conversation

@s-heppner
Copy link
Owner

Previously, there was a bug that potentially caused non-termination of the algorithm. If there was a loop that did not include the starting node, and the min_score was sufficiently low, the algorithm could return an arbitrarily large number of paths going round and round that loop.

While these paths are technically valid matches, they are not really constructive, in a sense that they do repeat the nodes that they match, just with different weights. Furthermore, it is necessary from a technical point of view to avoid them so that the algorithm terminates.

This adds an additional check that the current path does not run into such a loop, as well as the corresponding unittest to check that it works as intended.

Previously, there was a bug that potentially caused
non-termination of the algorithm. If there was a loop that did not
include the starting node, and the `min_score` was sufficiently
low, the algorithm could return an arbitrarily large number of
paths going round and round that loop.

While these paths are technically valid matches, they are not
really constructive, in a sense that they do repeat the nodes
that they match, just with different weights. Furthermore, it
is necessary from a technical point of view to avoid them
so that the algorithm terminates.

This adds an additional check that the current path does not run
into such a loop, as well as the corresponding unittest to check
that it works as intended.
@s-heppner s-heppner merged commit 1080f79 into main Dec 10, 2025
9 checks passed
@s-heppner s-heppner deleted the Fix/non-starting-node-loops branch December 10, 2025 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant