import { type GraphInstance } from './graphology-compat.js'; import type { DatabaseHandle } from '../store/db.js'; /** * Thin wrapper around a graphology instance built from the SQLite store. * * Only holds construction + basic accessors. Pure algorithmic operations * (paths, centrality, communities) live in sibling modules and accept the * graphology instance directly — call `graph()` to get it. */ export declare class KnowledgeGraph { private readonly g; private constructor(); /** * Build a directed multigraph from the store. Adds every node (with title * + frontmatter as attributes so community tag summaries work), then every * edge whose target exists as a node (dangling edges are silently dropped). * * `includeStubs` (default `false`): when `true`, includes broken-wikilink * stub nodes (`frontmatter._stub: true`) in the graph. Stubs have only one * incoming edge each and no outgoing edges, so leaving them in fragments * Louvain into thousands of trivial singleton clusters and dominates * eigenvector-style centrality with popular-but-empty link targets. * Default-excluding makes every graph tool (`detect_themes`, `rank_notes`, * `find_connections`, `find_path_between`) operate on the connected * "real-notes" graph by default. Pass `{ includeStubs: true }` to opt back * into the legacy behaviour. */ static fromStore(db: DatabaseHandle, options?: { includeStubs?: boolean; }): KnowledgeGraph; /** The underlying graphology instance — pass to pure analytics functions. */ graph(): GraphInstance; nodeCount(): number; edgeCount(): number; hasNode(id: string): boolean; nodeTitle(id: string): string; outNeighbors(id: string): string[]; inNeighbors(id: string): string[]; /** * Collapse the directed multigraph into an undirected simple graph. Useful * for Louvain/PageRank/betweenness which expect undirected input. */ toUndirected(): GraphInstance; } /** * Free function form of KnowledgeGraph#toUndirected for callers that already * have a raw graphology instance (e.g. the analytics modules). */ export declare function toUndirected(g: GraphInstance): GraphInstance;