[Haskell-cafe] FGL Question

Hans van Thiel hthiel.char at zonnet.nl
Sun May 24 07:09:22 EDT 2009


I want to get the top or the bottom elements of a graph, but the
following code appears to give the wrong answer in most cases, and the
right answer in a few cases. Any ideas?

-- get the most general or the least general  elements 
graphMLGen :: Bool ->  Gr [Rule] () ->  Gr [Rule] () 
graphMLGen pm gr =  buildGr unctxls  where 
                      unctxls = map remadj ctxls 
                      remadj (_,n,r,_) = ([],n,r,[])
                      ctxls | pm = gsel (\x -> outdeg' x == 0) gr
                            | otherwise = gsel (\x -> indeg' x == 0) gr

Many thanks,

Hans van Thiel

More information about the Haskell-Cafe mailing list