trying a more literal translation of algorithm given
fixed a bug; one spanning tree bug to go (haha jk everything is broken)