import { DepGraph } from 'dependency-graph';
export type SerializedGraph<Data = {
    type: string;
}> = {
    nodes: Array<{
        name: string;
        data?: Data;
    }>;
    dependencies: Array<{
        from: string;
        to: string;
    }>;
};
export declare class Graph<Data = {
    type: string;
}> extends DepGraph<Data> {
    static is<Data = {
        type: string;
    }>(data: unknown): data is SerializedGraph<Data>;
    static deserialize(message: SerializedGraph): Graph<{
        type: string;
    }>;
    constructor();
    /**
     * Extracts a subgraph related to the specified node
     * @param nodeName - name of the node for which to extract the subgraph
     * @returns new Graph instance with the extracted subgraph
     */
    extract(nodeName: string): Graph<Data>;
    /**
     * Consumes a serialized graph
     */
    consume(graph: Graph<Data> | SerializedGraph<Data> | undefined): this;
    /**
     * Removes node from graph
     * If node dependencies has no other dependants, they will be removed too
     * @param nodeName - node name to remove
     */
    release(nodeName: string): this;
    /**
     * Serializes the graph to a format for transfer between threads
     * @returns serialized representation of the graph
     */
    serialize(): SerializedGraph<Data>;
    /**
     * Recursively copies node dependencies
     */
    private copyDependenciesRecursively;
    /**
     * Recursively copies dependent nodes
     */
    private copyDependentsRecursively;
}
