# Documentation

:: (Ord a, Ord c, Num c) | |

=> (a -> Set a) | The graph we are searching through, given as a function from vertices to their neighbours. |

-> (a -> a -> c) | Distance function between neighbouring vertices of the graph. This will never be applied to vertices that are not neighbours, so may be undefined on pairs that are not neighbours in the graph. |

-> (a -> c) | Heuristic distance to the (nearest) goal. This should never overestimate the distance, or else the path found may not be minimal. |

-> (a -> Bool) | The goal, specified as a boolean predicate on vertices. |

-> a | The vertex to start searching from. |

-> Maybe [a] | An optimal path, if any path exists. This excludes the starting vertex. |

This function computes an optimal (minimal distance) path through a graph in a best-first fashion, starting from a given starting point.

:: (Monad m, Ord a, Ord c, Num c) | |

=> (a -> m (Set a)) | The graph we are searching through, given as a function from vertices to their neighbours. |

-> (a -> a -> m c) | Distance function between neighbouring vertices of the graph. This will never be applied to vertices that are not neighbours, so may be undefined on pairs that are not neighbours in the graph. |

-> (a -> m c) | Heuristic distance to the (nearest) goal. This should never overestimate the distance, or else the path found may not be minimal. |

-> (a -> m Bool) | The goal, specified as a boolean predicate on vertices. |

-> m a | The vertex to start searching from. |

-> m (Maybe [a]) | An optimal path, if any path exists. This excludes the starting vertex. |

This function computes an optimal (minimal distance) path through a graph in a best-first fashion, starting from a given starting point.