Using LightGraphs to find shortest path for eikonal solution

I was using FastMarching.jl to solve the eikonal equation for a given speed image, however the built-in shortestpath(…) function doesn’t give the correct solution - e.g. in a homogeneous speed image the shortest path b/w two points is a straight line, but it gives a bent line.

eikonal

Therefore, I was hoping to use the existing algorithms from LightGraphs.jl to find the shortest path. But from what I can see the inputs have to be graph objects. Is there a way to convert the matrix solution I have from FastMarching.jl to a graph object that LightGraphs.jl can understand?

In particular I was wanting to use dijkstra_shortest_paths(…) from LightGraphs.jl

Thinking about this a bit more, instead of trying to convert this to a graph object to get it working with LightGraphs.jl, I think I can just use a gradient descent method to find the fastest path. Since I can treat the fastest path problem as a minimization problem, where the gradient of the eikonal will point me in the direction of steepest descent, such that I can just follow the gradient down to the global minimum.