Module
Data.Graph.Pathfinding.Traced
- Package
- purescript-hylograph-graph
- Repository
- afcondon/purescript-hylograph-graph
Traced Pathfinding Algorithms
Visualization-friendly variants that record each step of the algorithm. Use these when you want to animate or visualize the search process.
import Data.Graph.Pathfinding.Traced (shortestPathTraced, SearchStep(..))
let traced = shortestPathTraced start goal graph
-- traced.result: the PathResult
-- traced.steps: Array of SearchStep for animation
#TracedResult Source
type TracedResult a = { explored :: Set NodeId, result :: a, steps :: Array SearchStep }Result of a traced algorithm Includes both the final result and the steps taken to get there
#SearchStep Source
#shortestPathTraced Source
shortestPathTraced :: NodeId -> NodeId -> Graph -> TracedResult PathResultFind shortest path with tracing
#dijkstraTraced Source
dijkstraTraced :: NodeId -> Graph -> TracedResult SearchResultDijkstra's algorithm with step-by-step tracing
#bfsTraced Source
bfsTraced :: NodeId -> Graph -> TracedResult SearchResultBFS with step-by-step tracing
#dfsTraced Source
dfsTraced :: NodeId -> Graph -> TracedResult SearchResultDFS with step-by-step tracing