Implementation of maximum branching algorithm (max spanning tree in directed graphs)