import Graph, {Attributes, NodeMapper, EdgeMapper} from 'graphology-types'; export type PartialEdgeMapper< T, EdgeAttributes extends Attributes = Attributes > = ( edge: string, attributes: EdgeAttributes, source: string, target: string ) => T; export type MinimalEdgeMapper< T, EdgeAttributes extends Attributes = Attributes > = (edge: string, attributes: EdgeAttributes) => T; interface NodeValueGetter { fromGraph(graph: Graph, node: unknown): T; fromAttributes(attributes: NodeAttributes): T; fromEntry: NodeMapper; } interface EdgeValueGetter< T, NodeAttributes extends Attributes = Attributes, EdgeAttributes extends Attributes = Attributes > { fromGraph(graph: Graph, edge: unknown): T; // fromPath( // graph: Graph, // source: unknown, // target: unknown // ): T; // fromDirectedPath( // graph: Graph, // source: unknown, // target: unknown // ): T; // fromUndirectedPath( // graph: Graph, // source: unknown, // target: unknown // ): T; fromAttributes(attributes: EdgeAttributes): T; fromEntry: EdgeMapper; fromPartialEntry: PartialEdgeMapper; fromMinimalEntry: MinimalEdgeMapper; } export function createNodeValueGetter< T, NodeAttributes extends Attributes = Attributes >( target?: string | NodeMapper, defaultValue?: T | ((value: unknown) => T) ): NodeValueGetter; export function createEdgeValueGetter< T, NodeAttributes extends Attributes = Attributes, EdgeAttributes extends Attributes = Attributes >( target?: | string | EdgeMapper | PartialEdgeMapper, defaultValue?: T | ((value: unknown) => T) ): EdgeValueGetter; export function createEdgeWeightGetter< NodeAttributes extends Attributes = Attributes, EdgeAttributes extends Attributes = Attributes >( target?: | string | EdgeMapper | PartialEdgeMapper ): EdgeValueGetter;