From 324b47cb6184ec40d2c66b2993c4cdcdad221790 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Sun, 2 Jan 2022 00:26:43 +0100 Subject: [PATCH] Add the BFS-related functions. --- manual.scrbl | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/manual.scrbl b/manual.scrbl index 6cb38f8..8a9f371 100644 --- a/manual.scrbl +++ b/manual.scrbl @@ -2,10 +2,11 @@ @(require (for-label (only-in typed/racket require/typed require/typed/provide - Any Boolean Void Sequenceof Listof List U False + Any Boolean Void Sequenceof Listof List U False Number Values Mutable-HashTable Immutable-HashTable)) (for-label (only-in math/matrix Matrix)) (for-label (only-in graph (matrix-graph? g:matrix-graph?))) + (for-label (only-in data/gen-queue/fifo mk-empty-fifo)) (for-label typed/graph)) @title{Typed Interface for the Generic Graph Library} @@ -121,6 +122,27 @@ matrix graphs. Graph properties are not supported. +@subsection{Basic Graph Functions} + +@defproc[(bfs [g Graph] [source Any]) (Values (Mutable-HashTable Any Number) + (Mutable-HashTable Any Any))]{} +@defproc[(bfs/generalized [g Graph] + [source Any] + [#:init-queue Q Any (mk-empty-fifo)] + [#:break break? (-> Graph Any Any Any Boolean) + (λ (G src from to) #f)] + [#:init init (U (-> Graph Any Void) Void) void] + [#:visit? custom-visit?-fn (U (-> Graph Any Any Any Boolean) False) + (λ (G src from to) #f)] + [#:discover discover (-> Graph Any Any Any Any Any) + (λ (G s u v acc) acc)] + [#:visit visit (-> Graph Any Any Any Any) + (λ (G s v acc) acc)] + [#:return finish (-> Graph Any Any Any) + (λ (G s acc) acc)] +) Any]{} +@defproc[(fewest-vertices-path [g Graph] [source Any] [target Any]) (U (Listof Any) False)]{} + @section{License} Like the generic graph library, this library is licensed under the Apache