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

5.8.1.0 crashes when computing dominators in graphs with unreachable nodes #109

Closed
koalaman opened this issue Feb 4, 2023 · 1 comment
Closed

Comments

@koalaman
Copy link

koalaman commented Feb 4, 2023

When computing dominators for connected, directed graphs, 5.8.1.0 crashes when it encounters nodes not reachable from the root. Here's a MCVE:

import Data.Graph.Inductive.Graph
import Data.Graph.Inductive.Query.Dominators
import Data.Graph.Inductive.PatriciaTree

main = do
    -- The graph  1 -> 2 <- 3
    let graph = mkGraph [(1,()), (2, ()), (3, ())] [(1,2,()), (3,2,())] :: Gr () ()
    -- 5.8.0.0: [(1,[1]),(2,[2,1]),(3,[1,2,3])]
    -- 5.8.1.0: Exception: IntMap.!: key 3 is not an element of the map
    print $ dom graph 1

The issue appears to have been introduced in c8f56c1.

@athas
Copy link
Contributor

athas commented Feb 5, 2023

I can reproduce. I will take a look.

Do we agree that the old behaviour of dom was clearly wrong, though? I'm fine with just reverting the change if the original behaviour was somehow sensible (beyond being just a load-bearing bug for various things), but the results it produced for unconnected graphs really did not mesh with my intuition of what "dominator" means.

@athas athas closed this as completed in 99a3739 Feb 5, 2023
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

2 participants