I use the Martin Ervig Functional Graphics Library (FGL) to represent the next simple oriented weighted graph.

genLNodes :: [LNode String] genLNodes = zip [1..5] ["A","B","C","D","E"] genLEdges :: [LEdge Int] genLEdges = [(1,2,4),(1,3,1),(2,4,2),(3,4,2),(2,5,1),(4,5,1), (2,1,4),(3,1,1),(4,2,2),(4,3,2),(5,2,1),(5,4,1)] mygraph :: Gr String Int mygraph = mkGraph genLNodes genLEdges
Now I want to find the shortest path from one node to another, for example. A to E using dijkstra algorithm. There seems to be a function to do this in Data.Graph.Inductive.Query.SP :
dijkstra :: (Graph gr, Real b) => Heap b (LPath b) -> gr ab -> LRTree b
But I canβt understand how to use it from the provided interface. Any help is appreciated. I would also like to hear any other suggestions if I correctly create a focused weighted schedule or if there is any other (best) package for this?