Skip to content

@graphty/algorithms / index / breadthFirstSearch

Function: breadthFirstSearch() ​

breadthFirstSearch(graph, startNode, options): TraversalResult

Defined in: algorithms/traversal/bfs-unified.ts:46

Perform breadth-first search starting from a given node

Automatically uses the most optimized implementation based on graph size. No configuration needed - just call this function for the best performance.

Parameters ​

graph ​

Graph

The input graph to traverse

startNode ​

NodeId

The node to start the BFS from

options ​

TraversalOptions = {}

Traversal options (callbacks, target node, etc.)

Returns ​

TraversalResult

Traversal result with visited nodes, order, and tree structure