import { Graph } from '../graph/graph'; import { InvalidInputError } from '../types/errors'; import { Edge, Node } from '../types/graph'; import { Result } from '../types/result'; /** * Triangle motif (3-clique) in undirected graph. * Represents three mutually connected nodes. */ export interface Triangle { /** Three nodes forming the triangle */ nodes: [N, N, N]; } /** * Star pattern motif. * Hub node with multiple leaf connections. */ export interface StarPattern { /** Central hub node */ hub: N; /** Leaf nodes connected to hub */ leaves: N[]; /** Star type (in-star or out-star) */ type: "in" | "out"; } /** * Co-citation pair (papers cited together). * Two papers frequently cited by the same citing papers. */ export interface CoCitationPair { /** First co-cited paper */ paper1: N; /** Second co-cited paper */ paper2: N; /** Number of papers citing both */ count: number; } /** * Bibliographic coupling pair (papers citing same references). * Two papers sharing references in their bibliographies. */ export interface BibliographicCouplingPair { /** First coupled paper */ paper1: N; /** Second coupled paper */ paper2: N; /** Number of shared references */ sharedReferences: number; } /** * Options for star pattern detection. */ export interface StarPatternOptions { /** Minimum degree to qualify as star hub */ minDegree: number; /** Star type to detect */ type: "in" | "out"; } /** * Options for co-citation detection. */ export interface CoCitationOptions { /** Minimum co-citation count */ minCount: number; } /** * Options for bibliographic coupling detection. */ export interface BibliographicCouplingOptions { /** Minimum shared references */ minShared: number; } /** * Detect all triangles (3-cliques) in an undirected graph. * * Algorithm: For each edge (u,v), find common neighbors of u and v. * Each common neighbor w forms a triangle (u,v,w). * * Time complexity: O(E * d^2) where E = edges, d = max degree * Space complexity: O(T) where T = number of triangles * @param graph - Undirected graph to analyze * @returns Array of triangles found * @example * ```typescript * const graph = createTriangleGraph(); * const result = detectTriangles(graph); * if (result.ok) { * console.log(`Found ${result.value.length} triangles`); * } * ``` */ export declare const detectTriangles: (graph: Graph) => Result[], InvalidInputError>; /** * Detect star patterns (hub nodes with high degree). * * For directed graphs: * - in-star: hub has high in-degree (many nodes point to it) * - out-star: hub has high out-degree (hub points to many nodes) * * For undirected graphs: only out-star makes sense (total degree) * * Time complexity: O(N + E) where N = nodes, E = edges * Space complexity: O(S) where S = number of stars * @param graph - Graph to analyze * @param options - Detection options * @returns Array of star patterns found * @example * ```typescript * const result = detectStarPatterns(graph, { minDegree: 10, type: 'out' }); * if (result.ok) { * result.value.forEach(star => { * console.log(`Hub ${star.hub.id} has ${star.leaves.length} connections`); * }); * } * ``` */ export declare const detectStarPatterns: (graph: Graph, options: StarPatternOptions) => Result[], InvalidInputError>; /** * Detect co-citation pairs in directed citation graph. * * Two papers are co-cited when multiple papers cite both of them. * Identifies papers with similar research impact. * * Algorithm: * 1. For each citing paper, find all its references * 2. Count pairs of references cited together * 3. Return pairs meeting minimum threshold * * Time complexity: O(N * R^2) where N = papers, R = avg references per paper * Space complexity: O(P^2) where P = unique papers * @param graph - Directed citation graph * @param options - Detection options * @returns Array of co-citation pairs * @example * ```typescript * const result = detectCoCitations(graph, { minCount: 5 }); * if (result.ok) { * result.value.forEach(pair => { * console.log(`${pair.paper1.id} and ${pair.paper2.id} co-cited ${pair.count} times`); * }); * } * ``` */ export declare const detectCoCitations: (graph: Graph, options: CoCitationOptions) => Result[], InvalidInputError>; /** * Detect bibliographic coupling pairs in directed citation graph. * * Two papers are bibliographically coupled when they cite the same references. * Identifies papers with similar research topics. * * Algorithm: * 1. Build reference sets for each paper * 2. Compare reference sets pairwise * 3. Return pairs with sufficient overlap * * Time complexity: O(N^2 * R) where N = papers, R = avg references * Space complexity: O(N * R) for reference sets * @param graph - Directed citation graph * @param options - Detection options * @returns Array of bibliographic coupling pairs * @example * ```typescript * const result = detectBibliographicCoupling(graph, { minShared: 3 }); * if (result.ok) { * result.value.forEach(pair => { * console.log(`${pair.paper1.id} and ${pair.paper2.id} share ${pair.sharedReferences} refs`); * }); * } * ``` */ export declare const detectBibliographicCoupling: (graph: Graph, options: BibliographicCouplingOptions) => Result[], InvalidInputError>; //# sourceMappingURL=motif.d.ts.map