UNPKG

@graphty/algorithms

Version:

Graph algorithms library for browser environments implemented in TypeScript

25 lines 1.1 kB
import type { Graph } from "../../core/graph.js"; import type { NodeId, ShortestPathResult, TraversalOptions, TraversalResult } from "../../types/index.js"; /** * Breadth-First Search (BFS) implementation * * Explores graph level by level from a starting node. Guarantees shortest path * in unweighted graphs and can be used for various graph analysis tasks. */ /** * Perform breadth-first search starting from a given node */ export declare function breadthFirstSearch(graph: Graph, startNode: NodeId, options?: TraversalOptions): TraversalResult; /** * Find shortest path between two nodes in an unweighted graph using BFS */ export declare function shortestPathBFS(graph: Graph, source: NodeId, target: NodeId): ShortestPathResult | null; /** * Find shortest paths from source to all reachable nodes using BFS */ export declare function singleSourceShortestPathBFS(graph: Graph, source: NodeId): Map<NodeId, ShortestPathResult>; /** * Check if the graph is bipartite using BFS coloring */ export declare function isBipartite(graph: Graph): boolean; //# sourceMappingURL=bfs.d.ts.map