Does the following algorithm have application in Machine Learning?

I wrote the following algorithm as a fun side-project to refresh my dynamic programming skills: GitHub - danieljaouen/dynamic-programming-in-elixir

Then, it hit me: might my algorithm have applications to Machine Learning? It is basically a “shortest path from source to sink through layers” algorithm. If you look at the code, it should be obvious what it is doing. Since Machine Learning uses neural layers that are connected to each other, with both a source and sink, would there be any applications to ML?

Thanks!