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

Perform calculations on all connected components #29

Open
vboussange opened this issue Dec 17, 2024 · 2 comments
Open

Perform calculations on all connected components #29

vboussange opened this issue Dec 17, 2024 · 2 comments

Comments

@vboussange
Copy link
Collaborator

vboussange commented Dec 17, 2024

Currently, only the giant connected component of the grid::Grid is used for downstream computations when used with prune

return largest_subgraph(g)

However, one may want to prune out some unsuitable pixels (where quality is e.g. 0, or where the pixel is not connected to any other pixel), but still perform computations on all connected components.

@vboussange vboussange changed the title Perform calculation on all connected components Perform calculations on all connected components Dec 17, 2024
@ninbrm
Copy link
Member

ninbrm commented Dec 17, 2024

Indeed, this has been a long standing issue: a single raster can give rise to multiple graphs or "Grids". For some of the algorithms to work properly there is the "strongly connected" assumption, hence the pruning. However, the result is that one could compute the metrics over all connected sub-grids (not only the largest one).

@rafaqz
Copy link
Collaborator

rafaqz commented Mar 5, 2025

There is another problem with this: the largest subgraph may not necessarily include all or even any of the target pixels, resulting in an empty grid.

I think we should just prune to a grid containing all subgraphs that contain target nodes. It may be faster to split it into multiple grids for each subgraph that contains targets, but also trickier to use.

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

No branches or pull requests

3 participants