Fixed output to read Inf for unreachable vertices