The idea was to store branches and their parents. I.e. we select the longest branch and make it root. After that we select second longest branch and so on. This is done with binary heap. After that we know for each vertex index of branch it belongs to, and it's parent. This all is done in O(NlogN) time. As far as I understand Tarjan algo uses Union disjoint structure. Did anyone use my approach?