import { NodeID, GraphTraits } from './GraphTraits'; export { NodeID }; /** * BaseImplicitGraph is an abstract class that represents an implicit graph. * An implicit graph is a graph representation where node and edge information is implicitly stored using maps. * This class implements the GraphTraits interface and provides basic graph operations. */ export declare abstract class BaseImplicitGraph implements GraphTraits { /** * idToNodeMap is an optional map that maps node IDs (NodeID) to node objects (Node). * If not initialized, calling related methods will throw an error. */ protected idToNodeMap?: Map; /** * nodeToIdMap is a map that maps node objects (Node) to node IDs (NodeID). * This map must be initialized in the subclass. */ protected nodeToIdMap: Map; /** * succMap is a map that stores the successors of each node. * The key is a node ID (NodeID), and the value is an array of successor node IDs. */ succMap: Map; /** * predMap is a map that stores the predecessors of each node. * The key is a node ID (NodeID), and the value is an array of predecessor node IDs. */ predMap: Map; constructor(); /** * Gets the number of nodes in the graph. * @returns The number of nodes in the graph. */ getNodeNum(): number; /** * Returns an iterator for all nodes in the graph. * @returns An iterator for traversing all nodes in the graph. */ nodesItor(): IterableIterator; /** * Gets the node object corresponding to a given node ID. * @param id The node ID. * @returns The corresponding node object. * @throws Throws an error if idToNodeMap is not initialized or if the node is not found. */ getNode(id: NodeID): Node; /** * Safely gets the node object corresponding to a given node ID. * Unlike {@link getNode}, this method does not throw; it returns undefined when the * idToNodeMap is not initialized or the node is not found. * @param id The node ID. * @returns The corresponding node object, or undefined when not found. */ tryGetNode(id: NodeID): Node | undefined; /** * Safely gets the node ID corresponding to a given node object. * Unlike {@link getNodeID}, this method does not throw; it returns undefined * when the node is not found in the nodeToIdMap. * @param node The node object. * @returns The corresponding NodeID, or undefined when not found. */ tryGetNodeID(node: Node): NodeID | undefined; getNodeID(s: Node): NodeID; /** * Checks whether the graph contains a specific node ID. * @param id The node ID. * @returns Returns true if the node ID exists in the graph; otherwise, returns false. * @throws Throws an error if idToNodeMap is not initialized. */ hasNode(id: NodeID): boolean; /** * Gets the list of successor node IDs for a given node. * @param id The node ID. * @returns An array of successor node IDs. Returns an empty array if no successors are found. */ succ(id: NodeID): NodeID[]; /** * Gets the list of predecessor node IDs for a given node. * @param id The node ID. * @returns An array of predecessor node IDs. Returns an empty array if no predecessors are found. */ pred(id: NodeID): NodeID[]; /** * Gets the nodeToIdMap, which maps node objects to node IDs. * @returns The nodeToIdMap. */ getNodeToIdMap(): Map; /** * Abstract method to get the name of the graph. * Subclasses must implement this method. * @returns The name of the graph. */ abstract getGraphName(): string; } //# sourceMappingURL=BaseImplicitGraph.d.ts.map