UNPKG

@gabrielrufino/cube

Version:

Data structures made in Typescript

22 lines (21 loc) 715 B
import type { Edge } from './Edge'; import type IGraph from './IGraph'; import type IGraphOptions from './IGraphOptions'; export default class Graph implements IGraph { private readonly _isDirected; private readonly _data; constructor({ inputs, isDirected }?: Readonly<IGraphOptions>); get isDirected(): boolean; get data(): { [key: string]: string[]; }; get size(): number; get nodes(): string[]; get edges(): Edge[]; insert(node: string): string | null; connect(node1: string, node2: string): Edge; breadthFirstSearch(startNode: string, callback: (_node: string) => void): void; getDistancesFrom(node: string): { [key: string]: number; }; }