UNPKG

@graphty/algorithms

Version:

Graph algorithms library for browser environments implemented in TypeScript

29 lines 1.29 kB
import type { Graph } from "../../core/graph.js"; import type { NodeId, ShortestPathResult, TraversalOptions, TraversalResult } from "../../types/index.js"; /** * 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. */ export declare function breadthFirstSearch(graph: Graph, startNode: NodeId, options?: TraversalOptions): TraversalResult; /** * Find shortest path between two nodes using BFS * * Automatically optimized for large graphs. Returns null if no path exists. */ export declare function shortestPathBFS(graph: Graph, source: NodeId, target: NodeId): ShortestPathResult | null; /** * Find shortest paths from source to all reachable nodes * * Automatically optimized for large graphs. */ export declare function singleSourceShortestPathBFS(graph: Graph, source: NodeId): Map<NodeId, ShortestPathResult>; /** * Check if the graph is bipartite using BFS coloring * * Note: This function does not use Direction-Optimized BFS as the * coloring logic is specific and doesn't benefit from the optimization. */ export declare function isBipartite(graph: Graph): boolean; //# sourceMappingURL=bfs-unified.d.ts.map