import { Graph } from '../../../algorithms/graph/graph'; import { Path } from '../../../algorithms/types/algorithm-results'; import { Edge, Node } from '../../../algorithms/types/graph'; /** * Ground truth type identifier */ export type GroundTruthType = "degree" | "pagerank" | "combined" | "domain-specific"; /** * Configuration for ground truth computation */ export interface GroundTruthConfig { /** Type of ground truth to compute */ type: GroundTruthType; /** For combined: weight for degree component (default: 0.5) */ degreeWeight?: number; /** For domain-specific: custom importance function per node */ customImportance?: (nodeId: string) => number; /** PageRank damping factor (default: 0.85) */ dampingFactor?: number; /** Aggregation method: 'mean' or 'sum' (default: 'mean') */ aggregation?: "mean" | "sum" | "geometric-mean"; /** Pre-computed importance values (avoids re-computing for same graph) */ precomputedImportance?: Map; } /** * Pre-computed importance values for a graph */ export interface PrecomputedImportance { degree: Map; pagerank: Map; combined: Map; } /** * Result of ground truth computation for a single path */ export interface GroundTruthPath { path: Path; score: number; nodeScores: number[]; } /** * Pre-compute all importance values for a graph * * Call this once per graph, then pass the result to computeGroundTruth * via the precomputedImportance config option for efficiency. * * @param graph - Graph to compute importance for * @param dampingFactor - PageRank damping factor (default: 0.85) * @param degreeWeight - Weight for degree in combined score (default: 0.5) * @returns Pre-computed importance values for all types */ export declare const precomputeImportance: (graph: Graph, dampingFactor?: number, degreeWeight?: number) => PrecomputedImportance; /** * Compute importance-based ground truth ranking for paths * * @param graph - Graph containing the paths * @param paths - Paths to rank * @param config - Ground truth configuration * @returns Paths sorted by ground truth score (descending) */ export declare const computeGroundTruth: (graph: Graph, paths: Path[], config: GroundTruthConfig) => GroundTruthPath[]; /** * Create a domain-specific importance function from node attributes * * @param nodes * @param attributeKey - Key to extract from node attributes * @param defaultValue - Default value if attribute is missing * @returns Importance function for use with domain-specific ground truth */ export declare const createAttributeImportance: (nodes: N[], attributeKey: string, defaultValue?: number) => (nodeId: string) => number; /** * Convenience function to compute all ground truth types for a set of paths * * @param graph - Graph containing the paths * @param paths - Paths to rank * @param customImportance - Optional custom importance for domain-specific * @returns Object with rankings for each ground truth type */ export declare const computeAllGroundTruths: (graph: Graph, paths: Path[], customImportance?: (nodeId: string) => number) => Record[]>; //# sourceMappingURL=importance-based.d.ts.map