The problem provides an 80 x 80 matrix in a text file, allowing traversal from the top left to the bottom right by only moving right and down.
As we discussed above, Dijkstra has one cost function which helps to find the shortest path from the source node to every other node by considering only the real cost (in contrast with A* heuristic). In order to solve the matrix problem, let's see how the graph implementation helps us.
First of all we will iterate through the matrix file and read the comma-delimited costs in the array. You can see the implementation in the following code snippet:
let weights = File.ReadAllLines("matrix.txt") |> Array.map(fun line -> line.Split(',') |> Array.map int32) let matrixHeight = weights.Length; ...