Fixed iterative depth-first-search to push to stack only one head vertex at a time