Figured out how to use a heap with Transitive Closure