125 - Numbering Paths

You may apply Floyd-Warshall algorithm to this problem.

Floyd-Warshall algorithm can be used for both numbering paths and marking infinite loops. Here is a reference solution.

Creative Commons License
This blog by Che-Liang Chiou is licensed under a Creative Commons Attribution 4.0 International License.