Skip to content
New issue

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

fix(import-dependents), fix algorithm to get some missing paths #8669

Merged
merged 4 commits into from
Mar 14, 2024

Conversation

davidfirst
Copy link
Member

@davidfirst davidfirst commented Mar 13, 2024

Still, this is not a complete list of all paths, which can be huge and take very long to calculate (it's an NP-Hard problem).
To be able to run it in a reasonable amount of time, it's using "visitor" which helps to run each node only once.
However, this visitor caused a bug in the following scenario:
A -> B1 -> D -> E
A -> B2 -> D -> E
The traversal was done using DFS, so it started with A -> B1 all the way to E. Then, because D is already visited, it was skipping the other path [A, B2, D, E].

This PR uses BFS instead and the check for visited is done before adding to the queue.
The end result is not only more paths, but also shorter and more relevant paths due to the BFS nature.

@davidfirst davidfirst changed the title fix(import-dependents), fix algorithm to get missing paths fix(import-dependents), fix algorithm to get some missing paths Mar 14, 2024
@davidfirst davidfirst merged commit 7ef82e5 into master Mar 14, 2024
11 checks passed
@davidfirst davidfirst deleted the import-dependents-missing-paths branch March 14, 2024 23:27
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.

2 participants