You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add test demoing that not all chains are found - #193
This PR isn't intended to be merged (although it could be if we like). It's here to demo a behaviour of find_illegal_dependencies_for_layers that I think might be misunderstood.
I think in discussions before we'd said that find_illegal_dependencies_for_layers finds all chains. I might be misremembering. Anyways, I just want to put this test case here to demo that not all chains are found.
Is there a way to find all the chains? I think not really (not in any performant way). I believe finding all paths between two nodes in a graph is an NP hard problem. So probably the existing behaviour is the best we can do. There are algorithms to find the K shortest paths (e.g. see https://docs.rs/pathfinding/latest/pathfinding/directed/yen/index.html), but even then you still have to limit the search somewhere (K paths).
Fine to close this PR if you like. I just wanted to put this here as a reminder of this behaviour and to provoke thought.
I wonder - should this behaviour be documented somewhere? I think the grimp docs don't explicitly say that all chains will be found, but equally they don't call out explicitly that some chains will not be found.
Update: I just found the existing test case test_longer_forked_routes_dont_appear, which is basically testing the same thing 🙈
I wonder - should this behaviour be documented somewhere? I think the grimp docs don't explicitly say that all chains will be found, but equally they don't call out explicitly that some chains will not be found.
I wonder - should this behaviour be documented somewhere? I think the grimp docs don't explicitly say that all chains will be found, but equally they don't call out explicitly that some chains will not be found.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR isn't intended to be merged (although it could be if we like). It's here to demo a behaviour of
find_illegal_dependencies_for_layersthat I think might be misunderstood.I think in discussions before we'd said that
find_illegal_dependencies_for_layersfinds all chains. I might be misremembering. Anyways, I just want to put this test case here to demo that not all chains are found.Why does this happen? The code here https://github.com/seddonym/grimp/blob/8c1bb5dd23087c4095c57347da46ae3110db439d/rust/src/graph/higher_order_queries.rs#L151-L157 pops all the imports along a chain when a chain is found.
Is there a way to find all the chains? I think not really (not in any performant way). I believe finding all paths between two nodes in a graph is an NP hard problem. So probably the existing behaviour is the best we can do. There are algorithms to find the K shortest paths (e.g. see https://docs.rs/pathfinding/latest/pathfinding/directed/yen/index.html), but even then you still have to limit the search somewhere (K paths).
Fine to close this PR if you like. I just wanted to put this here as a reminder of this behaviour and to provoke thought.
I wonder - should this behaviour be documented somewhere? I think the grimp docs don't explicitly say that all chains will be found, but equally they don't call out explicitly that some chains will not be found.
Update: I just found the existing test case
test_longer_forked_routes_dont_appear, which is basically testing the same thing 🙈