fix DAG memleak issue;add new algor union-find
fix union find bug