I recently played around with graphs and tried to implement Depth-First Search in a functional and recursive way. In the following examples we are talking about the following simple directed unweighted graph with vertices a to e: (click to enlarge) Each vertex is represented by an object of the following class: class Vertex() { val name: Char val edges: Set[Vertex] } Let's start with an approach that is neither functional nor recursive, but at least straight-forward: def dfsMutableIterative(s...