-
-postorder_dfs g@(LGraph _ blocks) =
- let FGraph _ eblock _ = entry g
- in vnode (zip eblock) (\acc _visited -> acc) [] emptyBlockSet
+--
+-- Here's an easy way to go wrong! Consider
+-- A -> [B,C]
+-- B -> D
+-- C -> D
+-- Then ordinary dfs would give [A,B,D,C] which has a back ref from C to D.
+-- Better to geot [A,B,C,D]
+
+
+postorder_dfs g@(LGraph _ blockenv) =
+ let FGraph id eblock _ = entry g in
+ zip eblock : postorder_dfs_from_except blockenv eblock (unitUniqSet id)
+
+postorder_dfs_from_except :: (HavingSuccessors b, LastNode l)
+ => BlockEnv (Block m l) -> b -> BlockSet -> [Block m l]
+postorder_dfs_from_except blocks b visited =
+ vchildren (get_children b) (\acc _visited -> acc) [] visited