sliceGraph :: SourceGraphArgs -> SGraph -> (SGraph,Set Entity)
sliceGraph args sg = case rootEntities args of
    Nothing -> (sg,Set.empty)
    Just starts -> (sg',Set.fromList $ map snd lslice)
        where
        g = graph sg
        lnodes = labNodes g
        start_lnodes = filter (flip Set.member starts . SG.name . snd) lnodes
        slice = accessibleFrom g (map fst start_lnodes)
        lslice = map (\i -> (i,fromJust $ lab g i)) slice
        sg' = updateGraph (subgraph (map fst lslice)) sg
sliceGraph :: SourceGraphArgs -> SGraph -> (SGraph,Set Entity)
sliceGraph args sg = case rootEntities args of
    Nothing -> (sg,Set.empty)
    Just starts -> (sg',Set.fromList $ map snd lslice)
        where
        g = graph sg
        lnodes = labNodes g
        start_lnodes = filter (flip Set.member starts . SG.name . snd) lnodes
        slice = accessibleFrom g (map fst start_lnodes)
        lslice = map (\i -> (i,fromJust $ lab g i)) slice
        sg' = updateGraph (subgraph (map fst lslice)) sg
sliceGraph args sg = case rootEntities args of
    Nothing -> (sg,Set.empty)
    Just starts -> (sg',Set.fromList $ map snd lslice)
        where
        g = graph sg
        lnodes = labNodes g
        start_lnodes = filter (flip Set.member starts . SG.name . snd) lnodes
        slice = accessibleFrom g (map fst start_lnodes)
        lslice = map (\i -> (i,fromJust $ lab g i)) slice
        sg' = updateGraph (subgraph (map fst lslice)) sg