@ts-search/core
v0.0.0
Published
Three graph search algorithms: 1. Breadth-first-search `bfs` 2. Depth-first search `dfs` 3. Dijkstras algorithm `dijkstra`
Downloads
1
Readme
Functional graph search algorithms
Three graph search algorithms:
- Breadth-first-search
bfs
- Depth-first search
dfs
- Dijkstras algorithm
dijkstra
Usage
Each function takes three parameters
next: (a: A) => A[]
Thenext
function should take a node and return a list of neighboring new nodes.found: Predicate<A>
Thefound
predicate returns true when we found the nodeinitial: A
The starting node
Examples
You can find examples in the packages/core/_examples/ folder