meta-log-db
Version:
Native database package for Meta-Log (ProLog, DataLog, R5RS)
69 lines • 1.72 kB
TypeScript
/**
* DAG Manager
*
* Manages Directed Acyclic Graph operations for MetaLogNodes
*/
import { DAG } from './types.js';
import { MetaLogNode, CID } from '../metalog-node/types.js';
/**
* DAG Manager
*
* Handles DAG operations: LCA finding, ancestor/descendant queries, node management
*/
export declare class DAGManager {
private dag;
constructor(dag?: DAG);
/**
* Get DAG instance
*/
getDAG(): DAG;
/**
* Add node to DAG
*
* @param node - MetaLogNode to add
*/
addNode(node: MetaLogNode): void;
/**
* Find Lowest Common Ancestor (LCA) of two nodes
*
* @param cid1 - First node CID
* @param cid2 - Second node CID
* @returns LCA CID or null if no common ancestor
*/
findLCA(cid1: CID, cid2: CID): CID | null;
/**
* Get all ancestors of a node
*
* @param cid - Node CID
* @returns Array of ancestor CIDs (ordered from immediate parent to root)
*/
getAncestors(cid: CID): CID[];
/**
* Get all children of a node
*
* @param cid - Node CID
* @returns Array of child CIDs
*/
getChildren(cid: CID): CID[];
/**
* Get all descendants of a node (recursive)
*
* @param cid - Node CID
* @returns Array of descendant CIDs
*/
getDescendants(cid: CID): CID[];
/**
* Get depth of a node (distance from root)
*
* @param cid - Node CID
* @returns Depth (0 for root nodes)
*/
getDepth(cid: CID): number;
/**
* Check if DAG has cycles (should always return false for valid DAG)
*
* @returns true if cycle detected
*/
hasCycles(): boolean;
}
//# sourceMappingURL=manager.d.ts.map