UNPKG

@specs-feup/lara

Version:

A js port of the popular framework for building source-to-source compilers

35 lines 1.89 kB
import DotFormatter from "./DotFormatter.js"; import EdgeData from "./EdgeData.js"; import NodeData from "./NodeData.js"; import cytoscape from "../../libs/cytoscape-3.26.0.js"; /** * Utility class related with graph creation and manipulation. * * Current implementation uses Cytoscape.js (https://js.cytoscape.org/) */ export default class Graphs { /** * @param config - Configuration for the graph, according to what Cytoscape accepts as configuration object */ static newGraph(config?: {}): cytoscape.Core; /** * @deprecated Does nothing. Cytoscape should be loaded by the user. */ static loadLibrary(): void; static addNode(graph: cytoscape.Core, nodeData: NodeData | Record<string, unknown>): cytoscape.CollectionReturnValue; static addEdge(graph: cytoscape.Core, sourceNode: cytoscape.NodeSingular, targetNode: cytoscape.NodeSingular, edgeData: EdgeData | Record<string, unknown>): cytoscape.CollectionReturnValue; static toDot(graph: cytoscape.Core, dotFormatter?: DotFormatter): string; /** * @returns True if the outdegree (number of edges with this node as source) is zero, false otherwise. By default, if a node has a connection to itself (loop) it is not considered a leaf */ static isLeaf(node: cytoscape.NodeSingular, loopsAreLeafs?: boolean): boolean; /** * Removes a node from the graph. Before removing the node, creates connections between all connecting sources and targets. * * @param graph - * @param node - * @param edgeMap - function that receives the incoming edge and the outgoing edge, and returns a new EdgeData that replaces both edges */ static removeNode(graph: cytoscape.Core, node: cytoscape.NodeSingular, edgeMapper: (incoming: cytoscape.EdgeSingular, outgoing: cytoscape.EdgeSingular) => EdgeData): void; } //# sourceMappingURL=Graphs.d.ts.map