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

data SearchStep

A step in the search algorithm, useful for visualization/animation

Constructors

Instances

#shortestPathTraced Source

shortestPathTraced :: NodeId -> NodeId -> Graph -> TracedResult PathResult

Find shortest path with tracing

#dijkstraTraced Source

dijkstraTraced :: NodeId -> Graph -> TracedResult SearchResult

Dijkstra's algorithm with step-by-step tracing

#bfsTraced Source

bfsTraced :: NodeId -> Graph -> TracedResult SearchResult

BFS with step-by-step tracing

#dfsTraced Source

dfsTraced :: NodeId -> Graph -> TracedResult SearchResult

DFS with step-by-step tracing