fix heap data structure and graph connected algorithm