@rimbu/graph
Version:
Immutable Graph data structures for TypeScript
37 lines (36 loc) • 1.98 kB
text/typescript
import { type StreamSource } from '@rimbu/stream';
import type { RelatedTo } from '@rimbu/common';
import type { GraphTypesContextImpl } from '@rimbu/graph/custom';
import type { Link, WithGraphValues } from '../../common/index.cjs';
import { GraphElement } from '../../common/index.cjs';
export declare class GraphBuilder<N, Tp extends GraphTypesContextImpl, TpG extends WithGraphValues<Tp, N, any> = WithGraphValues<Tp, N, any>> {
readonly isDirected: boolean;
readonly context: TpG['context'];
source?: TpG["nonEmpty"] | undefined;
connectionSize: number;
constructor(isDirected: boolean, context: TpG['context'], source?: TpG["nonEmpty"] | undefined);
_linkMap?: TpG['linkMapBuilder'];
_lock: number;
checkLock(): void;
get linkMap(): TpG['linkMapBuilder'];
get isEmpty(): boolean;
get nodeSize(): number;
hasNode: <UN>(node: RelatedTo<N, UN>) => boolean;
hasConnection: <UN>(node1: RelatedTo<N, UN>, node2: RelatedTo<N, UN>) => boolean;
addNodeInternal: (node: N) => boolean;
addNode: (node: N) => boolean;
addNodes: (nodes: StreamSource<N>) => boolean;
removeNodeInternal: <UN>(node: RelatedTo<N, UN>) => boolean;
removeNode: <UN>(node: RelatedTo<N, UN>) => boolean;
removeNodes: <UN>(nodes: StreamSource<RelatedTo<N, UN>>) => boolean;
connectInternal: (node1: N, node2: N) => boolean;
connect: (node1: N, node2: N) => boolean;
connectAll: (connections: StreamSource<TpG["link"]>) => boolean;
connectIfNodesExist: (node1: N, node2: N) => boolean;
addGraphElement: (element: GraphElement<N>) => boolean;
addGraphElements: (elements: StreamSource<GraphElement<N>>) => boolean;
disconnectInternal: <UN>(node1: RelatedTo<N, UN>, node2: RelatedTo<N, UN>) => boolean;
disconnect: <UN>(node1: RelatedTo<N, UN>, node2: RelatedTo<N, UN>) => boolean;
disconnectAll: <UN>(connections: StreamSource<Link<RelatedTo<N, UN>>>) => boolean;
build: () => TpG["normal"];
}