/*! * Copyright 2020 Ron Buckton * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { GraphNode } from "./graphNode"; import type { GraphLink } from "./graphLink"; import { GraphSchema } from "./graphSchema"; import { GraphObject } from "./graphObject"; import { GraphNodeCollection } from "./graphNodeCollection"; import { GraphLinkCollection } from "./graphLinkCollection"; import { GraphNodeIdLike } from "./graphNodeIdLike"; /** * A directed graph consisting of nodes and links. */ export declare class Graph extends GraphObject { private _links; private _nodes; private _schema; private _metadata; constructor(); /** * Gets the graph that this object belongs to. */ get owner(): Graph; /** * Gets the document schema for this object. */ get schema(): GraphSchema; /** * Gets the collection of links in the graph. */ get links(): GraphLinkCollection; /** * Gets the collection of nodes in the graph. */ get nodes(): GraphNodeCollection; /** * Adds a new schema to the graph. */ addSchema(schema: GraphSchema): this; /** * Copies the schemas from another graph. */ copySchemas(graph: Graph): boolean; /** * Imports a link (along with its source and target nodes) into the graph. */ importLink(link: GraphLink): GraphLink; /** * Imports a node into the graph. * @param depth The depth of related links to import. */ importNode(node: GraphNode, depth?: number): GraphNode; /** * Clears the links and nodes of the graph. */ clear(): void; /** * Renames a node. * @param newId The new id for the node. */ renameNode(node: GraphNode, newId: GraphNodeIdLike): GraphNode; /** * Renames a node. * @param nodeId The id of the node to rename. * @param newId The new id for the node. */ renameNode(nodeId: GraphNodeIdLike, newId: GraphNodeIdLike): GraphNode | undefined; private _importLink; private _importNode; }