updateSubgraph :: IntMap [Int] -> Subgraph -> Int -> Subgraph
updateSubgraph graph (Subgraph vs ds) v =
  let rn    = remainingNeighbors graph vs v
      newVs = foldl' (flip delete) vs (v:rn)
      newDs = filter (flip member newVs . fst) ds
      reduced = map (map (\x -> (x,-1)) . remainingNeighbors graph newVs) rn
      newestDs = foldr addListIntMaps [] (newDs : reduced) 
  in Subgraph newVs newestDs
updateSubgraph :: IntMap [Int] -> Subgraph -> Int -> Subgraph
updateSubgraph graph (Subgraph vs ds) v =
  let rn    = remainingNeighbors graph vs v
      newVs = foldl' (flip delete) vs (v:rn)
      newDs = filter (flip member newVs . fst) ds
      reduced = map (map (\x -> (x,-1)) . remainingNeighbors graph newVs) rn
      newestDs = foldr addListIntMaps [] (newDs : reduced) 
  in Subgraph newVs newestDs
updateSubgraph graph (Subgraph vs ds) v =
  let rn    = remainingNeighbors graph vs v
      newVs = foldl' (flip delete) vs (v:rn)
      newDs = filter (flip member newVs . fst) ds
      reduced = map (map (\x -> (x,-1)) . remainingNeighbors graph newVs) rn
      newestDs = foldr addListIntMaps [] (newDs : reduced) 
  in Subgraph newVs newestDs