es-next-tools
Version:
A comprehensive utility library for JavaScript and TypeScript that provides a wide range of functions for common programming tasks, including mathematical operations, date manipulations, array and object handling, string utilities, and more.
24 lines (23 loc) • 720 B
TypeScript
/**
* Represents a graph data structure using an adjacency list.
*/
export declare class Graph {
private adjacencyList;
/**
* Adds a vertex to the graph.
* @param {string} vertex - The vertex to add.
*/
addVertex(vertex: string): void;
/**
* Adds an edge between two vertices.
* @param {string} vertex1 - The first vertex.
* @param {string} vertex2 - The second vertex.
*/
addEdge(vertex1: string, vertex2: string): void;
/**
* Performs a breadth-first search (BFS) starting from a given vertex.
* @param {string} start - The starting vertex.
* @returns {string[]} The vertices visited in BFS order.
*/
bfs(start: string): string[];
}