-- | Compute the list of vertices visited by the /depth-first search/ in a
-- graph, when searching from each of the given vertices in order.
--
-- In the following examples we will use the helper function:
--
-- @
-- (%) :: (GraphKL Int -> a) -> 'AM.AdjacencyMap' Int -> a
-- a % g = a $ 'fromAdjacencyMap' g
-- @
--
-- for greater clarity.
--
-- @
-- dfs [1]   % 'AM.edge' 1 1                 == [1]
-- dfs [1]   % 'AM.edge' 1 2                 == [1,2]
-- dfs [2]   % 'AM.edge' 1 2                 == [2]
-- dfs [3]   % 'AM.edge' 1 2                 == []
-- dfs [1,2] % 'AM.edge' 1 2                 == [1,2]
-- dfs [2,1] % 'AM.edge' 1 2                 == [2,1]
-- dfs []    % x                        == []
-- dfs [1,4] % (3 * (1 + 4) * (1 + 5))  == [1,5,4]
-- 'AM.isSubgraphOf' ('AM.vertices' $ dfs vs x) x == True
-- @
dfs :: [a] -> GraphKL a -> [a]
dfs vs = concatMap flatten . dfsForestFrom vs
dfs :: [a] -> GraphKL a -> [a]
dfs vs = concatMap flatten . dfsForestFrom vs
dfs vs = concatMap flatten . dfsForestFrom vs