Use -1 to denote unreachability instead of INT_MAX