@rimbu/graph
Version:
Immutable Graph data structures for TypeScript
43 lines (42 loc) • 2.43 kB
text/typescript
import { type Token } from '@rimbu/base';
import { OptLazy, OptLazyOr, type RelatedTo } from '@rimbu/common';
import { type StreamSource } from '@rimbu/stream';
import type { ValuedGraphTypesContextImpl } from '@rimbu/graph/custom';
import type { Link, WithGraphValues } from '../../common/index.mjs';
import { ValuedGraphElement } from '../../common/index.mjs';
export declare class ValuedGraphBuilder<N, V, Tp extends ValuedGraphTypesContextImpl, TpG extends WithGraphValues<Tp, N, V> = WithGraphValues<Tp, N, V>> {
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;
getValue: <UN, O>(node1: RelatedTo<N, UN>, node2: RelatedTo<N, UN>, otherwise?: OptLazy<O>) => V | O;
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, value: V) => boolean;
connect: (node1: N, node2: N, value: V) => boolean;
connectAll: (connections: StreamSource<TpG["link"]>) => boolean;
addGraphElement: (element: ValuedGraphElement<N, V>) => boolean;
addGraphElements: (elements: StreamSource<ValuedGraphElement<N, V>>) => boolean;
modifyAt: (node1: N, node2: N, options: {
ifNew?: OptLazyOr<V, Token>;
ifExists?: ((value: V, remove: Token) => V | Token) | V;
}) => 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"];
buildMapValues: <V2>(mapFun: (value: V, node1: N, node2: N) => V2) => WithGraphValues<Tp, N, V2>["normal"];
}