fixed bug with graph union cycle