import type { Link } from './index.cjs'; /** * A valued connection between two nodes, * being a 3-valued tuple of which the * first two elements are nodes and the last element a value * @typeparam N - the node type * @typeparam V - the value type */ export type ValuedLink = [N, N, V]; export declare namespace ValuedLink { type Target = readonly [N, V]; function fromArgs(node1: N, node2: N, value: V): ValuedLink; } export type ValuedGraphElement = [N] | ValuedLink; export declare namespace ValuedGraphElement { /** * Returns true if the given graph element `e` is a single node. * Instructs the compiler that the type is a 1-tuple. * @param e - the graph element */ function isSingleNode(e: ValuedGraphElement): e is [unknown]; /** * Returns true if the given graph element `e` is a 3-tuple. * Instructs the compiler that the type is a 3-tuple. * @param e - the graph element */ function isLink(e: ValuedGraphElement): e is [unknown, unknown, unknown]; /** * Returns the value of a single node graph element if the given element `e` is a single * node, or the given `otherwise` fallback value otherwise. * @param e - the graph element * @param otherwise - (default: undefined) the fallback value to return * if the given element is not a single node */ function getSingleNode(e: ValuedGraphElement): N | undefined; /** * Returns the nodes of the link graph element if the given element `e` is * a Link element, or undefined otherwise. * @param e - the graph element */ function getLink(e: ValuedGraphElement): Link | undefined; /** * Returns the element at the given `key` in the graph element `e`, * if the element is a Link element, or returns the given `otherwise` value * otherwise. * @param e - the graph element * @param key - the link key * @param otherwise - (default: undefined) the fallback value */ function getLinkElement>(e: ValuedGraphElement, key: K): ValuedLink[K] | undefined; }