The heap crap in dijkstra isn't necessary for this specific problem. And even if it was, I completely implemented the values of the queue wrong. Luckily, the code was unnecessary and had zero affect on the outcome. Removing the extra stuff also resulted in a nice speedup.
…s lost after assigning root = nil