import { EdgeBase, NodeBase, ReadableGraph } from '../../interfaces/readable-graph'; export interface EgoNetworkOptions { /** Number of hops to include (0 = seed nodes only, 1 = immediate neighbors) */ radius: number; /** Seed node IDs to extract ego networks around */ seedNodes: string[]; /** Whether to include seed nodes in result (default: true) */ includeSeed?: boolean; } export interface ExtractionError { type: "invalid-input" | "invalid-options"; message: string; } export interface InducedSubgraph { /** Nodes in the extracted subgraph */ nodes: N[]; /** Edges in the extracted subgraph (only edges between nodes in this subgraph) */ edges: E[]; } export interface Ok { ok: true; value: T; } export interface Error_ { ok: false; error: E; } export type Result = Ok | Error_; /** * Extracts a k-hop ego network around one or more seed nodes. * * An ego network includes all nodes within k hops (radius) of the seed nodes, * along with all edges between those nodes. This is useful for exploring * citation contexts, local neighborhoods, and relationship patterns. * * @param graph - Source graph to extract from (any ReadableGraph implementation) * @param options - Ego network extraction options * @returns Extracted subgraph or validation error * @example * ```typescript * // Using algorithms Graph class (via adapter) * const graph = new Graph(true); * // ... add nodes and edges ... * * const adapter = new GraphAdapter(graph); * const result = extractEgoNetwork(adapter, { * radius: 2, * seedNodes: ['P123'], * }); * * if (result.ok) { * console.log(`Found ${result.value.nodes.length} papers in 2-hop neighborhood`); * } * * // Using custom graph implementation * class MyDatabaseGraph implements ReadableGraph { * // ... implementation ... * } * * const result = extractEgoNetwork(new MyDatabaseGraph(), { * radius: 1, * seedNodes: ['A123', 'A456'], * }); * ``` */ export declare const extractEgoNetwork: (graph: ReadableGraph, options: EgoNetworkOptions) => Result, ExtractionError>; /** * Convenience wrapper for extracting multi-source ego network. * * Extracts the union of ego networks around multiple seed nodes. * This is a simplified API for the common case of multi-source extraction. * * @param graph - Source graph * @param seedNodes - Array of seed node IDs * @param radius - Number of hops to include * @param includeSeed - Whether to include seed nodes (default: true) * @returns Extracted subgraph or error * @example * ```typescript * // Extract 1-hop neighborhoods around multiple authors * const result = extractMultiSourceEgoNetwork( * adapter, * ['A123', 'A456', 'A789'], * 1 * ); * ``` */ export declare const extractMultiSourceEgoNetwork: (graph: ReadableGraph, seedNodes: string[], radius: number, includeSeed?: boolean) => Result, ExtractionError>; //# sourceMappingURL=ego-network.d.ts.map