To represent infinity, use a large constant (e.g., or ). Do not use the maximum integer value (e.g., ), because adding two infinities can cause overflow. After Floyd-Warshall, if dist[i][j] is still infinity, there is no path from to .
Choose your infinity constant based on the problem constraints. If weights are at most and paths have at most edges, use infinity .