8 lines
46 KiB
Plaintext
8 lines
46 KiB
Plaintext
{
|
|
"version": 3,
|
|
"sources": ["../../../../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/graph.js"],
|
|
"sourcesContent": ["import * as _ from 'lodash-es';\n\nvar DEFAULT_EDGE_NAME = '\\x00';\nvar GRAPH_NODE = '\\x00';\nvar EDGE_KEY_DELIM = '\\x01';\n\n/**\n * @typedef {string} NodeID ID of a node.\n */\n\n/**\n * @typedef {`${string}${typeof EDGE_KEY_DELIM}${string}${typeof EDGE_KEY_DELIM}${string}`} EdgeID ID of an edge.\n * @internal - All public APIs use {@link EdgeObj} instead to refer to edges.\n */\n\n/**\n * @typedef {object} EdgeObj\n * @property {NodeID} v the id of the source or tail node of an edge\n * @property {NodeID} w the id of the target or head node of an edge\n * @property {string | number} [name] Name of the edge. Needed to uniquely identify\n * multiple edges between the same pair of nodes in a multigraph.\n */\n\n/**\n * @template {unknown} T\n * @typedef {T[] | Record<any, T>} Collection\n * Lodash object that can be iterated over with `_.each`.\n *\n * Beware, objects with `.length` are treated as arrays, see\n * https://lodash.com/docs/4.17.15#forEach\n */\n\n// Implementation notes:\n//\n// * Node id query functions should return string ids for the nodes\n// * Edge id query functions should return an \"edgeObj\", edge object, that is\n// composed of enough information to uniquely identify an edge: {v, w, name}.\n// * Internally we use an \"edgeId\", a stringified form of the edgeObj, to\n// reference edges. This is because we need a performant way to look these\n// edges up and, object properties, which have string keys, are the closest\n// we're going to get to a performant hashtable in JavaScript.\n\n// Implementation notes:\n//\n// * Node id query functions should return string ids for the nodes\n// * Edge id query functions should return an \"edgeObj\", edge object, that is\n// composed of enough information to uniquely identify an edge: {v, w, name}.\n// * Internally we use an \"edgeId\", a stringified form of the edgeObj, to\n// reference edges. This is because we need a performant way to look these\n// edges up and, object properties, which have string keys, are the closest\n// we're going to get to a performant hashtable in JavaScript.\n\n/**\n * @typedef {object} GraphOptions\n * @property {boolean | undefined} [directed] - set to `true` to get a\n * directed graph and `false` to get an undirected graph.\n * An undirected graph does not treat the order of nodes in an edge as\n * significant.\n * In other words, `g.edge(\"a\", \"b\") === g.edge(\"b\", \"a\")` for\n * an undirected graph.\n * Default: `true`\n * @property {boolean | undefined} [multigraph] - set to `true` to allow a\n * graph to have multiple edges between the same pair of nodes.\n * Default: `false`.\n * @property {boolean | undefined} [compound] - set to `true` to allow a\n * graph to have compound nodes - nodes which can be the parent of other\n * nodes.\n * Default: `false`.\n */\n\n/**\n * Graphlib has a single graph type: {@link Graph}. To create a new instance:\n *\n * ```js\n * var g = new Graph();\n * ```\n *\n * By default this will create a directed graph that does not allow multi-edges\n * or compound nodes.\n * The following options can be used when constructing a new graph:\n *\n * * {@link GraphOptions#directed}: set to `true` to get a directed graph and `false` to get an\n * undirected graph.\n * An undirected graph does not treat the order of nodes in an edge as\n * significant. In other words,\n * `g.edge(\"a\", \"b\") === g.edge(\"b\", \"a\")` for an undirected graph.\n * Default: `true`.\n * * {@link GraphOptions#multigraph}: set to `true` to allow a graph to have multiple edges\n * between the same pair of nodes. Default: `false`.\n * * {@link GraphOptions#compound}: set to `true` to allow a graph to have compound nodes -\n * nodes which can be the parent of other nodes. Default: `false`.\n *\n * To set the options, pass in an options object to the `Graph` constructor.\n * For example, to create a directed compound multigraph:\n *\n * ```js\n * var g = new Graph({ directed: true, compound: true, multigraph: true });\n * ```\n *\n * ### Node and Edge Representation\n *\n * In graphlib, a node is represented by a user-supplied String id.\n * All node related functions use this String id as a way to uniquely identify\n * the node. Here is an example of interacting with nodes:\n *\n * ```js\n * var g = new Graph();\n * g.setNode(\"my-id\", \"my-label\");\n * g.node(\"my-id\"); // returns \"my-label\"\n * ```\n *\n * Edges in graphlib are identified by the nodes they connect. For example:\n *\n * ```js\n * var g = new Graph();\n * g.setEdge(\"source\", \"target\", \"my-label\");\n * g.edge(\"source\", \"target\"); // returns \"my-label\"\n * ```\n *\n * However, we need a way to uniquely identify an edge in a single object for\n * various edge queries (e.g. {@link Graph#outEdges}).\n * We use {@link EdgeObj}s for this purpose.\n * They consist of the following properties:\n *\n * * {@link EdgeObj#v}: the id of the source or tail node of an edge\n * * {@link EdgeObj#w}: the id of the target or head node of an edge\n * * {@link EdgeObj#name} (optional): the name that uniquely identifies a multiedge.\n *\n * Any edge function that takes an edge id will also work with an {@link EdgeObj}. For example:\n *\n * ```js\n * var g = new Graph();\n * g.setEdge(\"source\", \"target\", \"my-label\");\n * g.edge({ v: \"source\", w: \"target\" }); // returns \"my-label\"\n * ```\n *\n * ### Multigraphs\n *\n * A [multigraph](https://en.wikipedia.org/wiki/Multigraph) is a graph that can\n * have more than one edge between the same pair of nodes.\n * By default graphlib graphs are not multigraphs, but a multigraph can be\n * constructed by setting the {@link GraphOptions#multigraph} property to true:\n *\n * ```js\n * var g = new Graph({ multigraph: true });\n * ```\n *\n * With multiple edges between two nodes we need some way to uniquely identify\n * each edge. We call this the {@link EdgeObj#name} property.\n * Here's an example of creating a couple of edges between the same nodes:\n *\n * ```js\n * var g = new Graph({ multigraph: true });\n * g.setEdge(\"a\", \"b\", \"edge1-label\", \"edge1\");\n * g.setEdge(\"a\", \"b\", \"edge2-label\", \"edge2\");\n * g.edge(\"a\", \"b\", \"edge1\"); // returns \"edge1-label\"\n * g.edge(\"a\", \"b\", \"edge2\"); // returns \"edge2-label\"\n * g.edges(); // returns [{ v: \"a\", w: \"b\", name: \"edge1\" },\n * // { v: \"a\", w: \"b\", name: \"edge2\" }]\n * ```\n *\n * A multigraph still allows an edge with no name to be created:\n *\n * ```js\n * var g = new Graph({ multigraph: true });\n * g.setEdge(\"a\", \"b\", \"my-label\");\n * g.edge({ v: \"a\", w: \"b\" }); // returns \"my-label\"\n * ```\n *\n * ### Compound Graphs\n *\n * A compound graph is one where a node can be the parent of other nodes.\n * The child nodes form a \"subgraph\".\n * Here's an example of constructing and interacting with a compound graph:\n *\n * ```js\n * var g = new Graph({ compound: true });\n * g.setParent(\"a\", \"parent\");\n * g.setParent(\"b\", \"parent\");\n * g.parent(\"a\"); // returns \"parent\"\n * g.parent(\"b\"); // returns \"parent\"\n * g.parent(\"parent\"); // returns undefined\n * ```\n *\n * ### Default Labels\n *\n * When a node or edge is created without a label, a default label can be assigned.\n * See {@link setDefaultNodeLabel} and {@link setDefaultEdgeLabel}.\n *\n * @template [GraphLabel=any] - Label of the graph.\n * @template [NodeLabel=any] - Label of a node.\n * Even though this is a \"label\", this could be any type that the user requires\n * (and may need to be an object for some layout/ranking algorithms in dagre).\n * @template [EdgeLabel=any] - Label of an edge.\n * Even though this is a \"label\", this could be any type that the user requires,\n * (and may need to be a object for ranking in dagre).\n */\nexport class Graph {\n /**\n * @param {GraphOptions} [opts] - Graph options.\n */\n constructor(opts = {}) {\n /**\n * @type {boolean}\n * @private\n */\n this._isDirected = Object.prototype.hasOwnProperty.call(opts, 'directed')\n ? opts.directed\n : true;\n /**\n * @type {boolean}\n * @private\n */\n this._isMultigraph = Object.prototype.hasOwnProperty.call(opts, 'multigraph')\n ? opts.multigraph\n : false;\n /**\n * @type {boolean}\n * @private\n */\n this._isCompound = Object.prototype.hasOwnProperty.call(opts, 'compound')\n ? opts.compound\n : false;\n\n /**\n * @type {GraphLabel | undefined}\n * Label for the graph itself\n */\n this._label = undefined;\n\n /**\n * Default label to be set when creating a new node.\n *\n * @private\n * @type {(v: NodeID | number) => NodeLabel}\n */\n this._defaultNodeLabelFn = _.constant(undefined);\n\n /**\n * Default label to be set when creating a new edge\n *\n * @private\n * @type {(v: NodeID, w: NodeID, name: string | undefined) => EdgeLabel}\n */\n this._defaultEdgeLabelFn = _.constant(undefined);\n\n /**\n * @type {Record<NodeID, NodeLabel>}\n * @private\n *\n * v -> label\n */\n this._nodes = {};\n\n if (this._isCompound) {\n /**\n * @type {Record<NodeID, NodeID>}\n * @private\n * v -> parent\n */\n this._parent = {};\n\n /**\n * @type {Record<NodeID, Record<NodeID, true>>}\n * @private\n * v -> children\n */\n this._children = {};\n this._children[GRAPH_NODE] = {};\n }\n\n /**\n * @type {Record<NodeID, Record<EdgeID, EdgeObj>>}\n * @private\n * v -> edgeObj\n */\n this._in = {};\n\n /**\n * @type {Record<NodeID, Record<NodeID, number>>}\n * @private\n * u -> v -> Number\n */\n this._preds = {};\n\n /**\n * @type {Record<NodeID, Record<EdgeID, EdgeObj>>}\n * @private\n * v -> edgeObj\n */\n this._out = {};\n\n /**\n * @type {Record<NodeID, Record<NodeID, number>>}\n * @private\n * v -> w -> Number\n */\n this._sucs = {};\n\n /**\n * @type {Record<EdgeID, EdgeObj>}\n * @private\n * e -> edgeObj\n */\n this._edgeObjs = {};\n\n /**\n * @type {Record<EdgeID, EdgeLabel>}\n * @private\n * e -> label\n */\n this._edgeLabels = {};\n }\n\n /* === Graph functions ========= */\n\n /**\n *\n * @returns {boolean} `true` if the graph is [directed](https://en.wikipedia.org/wiki/Directed_graph).\n * A directed graph treats the order of nodes in an edge as significant whereas an\n * [undirected](https://en.wikipedia.org/wiki/Graph_(mathematics)#Undirected_graph)\n * graph does not.\n * This example demonstrates the difference:\n *\n * @example\n *\n * ```js\n * var directed = new Graph({ directed: true });\n * directed.setEdge(\"a\", \"b\", \"my-label\");\n * directed.edge(\"a\", \"b\"); // returns \"my-label\"\n * directed.edge(\"b\", \"a\"); // returns undefined\n *\n * var undirected = new Graph({ directed: false });\n * undirected.setEdge(\"a\", \"b\", \"my-label\");\n * undirected.edge(\"a\", \"b\"); // returns \"my-label\"\n * undirected.edge(\"b\", \"a\"); // returns \"my-label\"\n * ```\n */\n isDirected() {\n return this._isDirected;\n }\n /**\n * @returns {boolean} `true` if the graph is a multigraph.\n */\n isMultigraph() {\n return this._isMultigraph;\n }\n /**\n * @returns {boolean} `true` if the graph is compound.\n */\n isCompound() {\n return this._isCompound;\n }\n\n /**\n * Sets the label for the graph to `label`.\n *\n * @param {GraphLabel} label - Label for the graph.\n * @returns {this}\n */\n setGraph(label) {\n this._label = label;\n return this;\n }\n\n /**\n * @returns {GraphLabel | undefined} the currently assigned label for the graph.\n * If no label has been assigned, returns `undefined`.\n *\n * @example\n *\n * ```js\n * var g = new Graph();\n * g.graph(); // returns undefined\n * g.setGraph(\"graph-label\");\n * g.graph(); // returns \"graph-label\"\n * ```\n */\n graph() {\n return this._label;\n }\n /* === Node functions ========== */\n\n /**\n * Sets a new default value that is assigned to nodes that are created without\n * a label.\n *\n * @param {typeof this._defaultNodeLabelFn | NodeLabel} newDefault - If a function,\n * it is called with the id of the node being created.\n * Otherwise, it is assigned as the label directly.\n * @returns {this}\n */\n setDefaultNodeLabel(newDefault) {\n if (!_.isFunction(newDefault)) {\n newDefault = _.constant(newDefault);\n }\n this._defaultNodeLabelFn = newDefault;\n return this;\n }\n\n /**\n * @returns {number} the number of nodes in the graph.\n */\n nodeCount() {\n return this._nodeCount;\n }\n\n /**\n * @returns {NodeID[]} the ids of the nodes in the graph.\n *\n * @remarks\n * Use {@link node()} to get the label for each node.\n * Takes `O(|V|)` time.\n */\n nodes() {\n return _.keys(this._nodes);\n }\n /**\n * @returns {NodeID[]} those nodes in the graph that have no in-edges.\n * @remarks Takes `O(|V|)` time.\n */\n sources() {\n var self = this;\n return _.filter(this.nodes(), function (v) {\n return _.isEmpty(self._in[v]);\n });\n }\n /**\n * @returns {NodeID[]} those nodes in the graph that have no out-edges.\n * @remarks Takes `O(|V|)` time.\n */\n sinks() {\n var self = this;\n return _.filter(this.nodes(), function (v) {\n return _.isEmpty(self._out[v]);\n });\n }\n\n /**\n * Invokes setNode method for each node in `vs` list.\n *\n * @param {Collection<NodeID | number>} vs - List of node IDs to create/set.\n * @param {NodeLabel} [value] - If set, update all nodes with this value.\n * @returns {this}\n * @remarks Complexity: O(|names|).\n */\n setNodes(vs, value) {\n var args = arguments;\n var self = this;\n _.each(vs, function (v) {\n if (args.length > 1) {\n self.setNode(v, value);\n } else {\n self.setNode(v);\n }\n });\n return this;\n }\n\n /**\n * Creates or updates the value for the node `v` in the graph.\n *\n * @param {NodeID | number} v - ID of the node to create/set.\n * @param {NodeLabel} [value] - If supplied, it is set as the value for the node.\n * If not supplied and the node was created by this call then\n * {@link setDefaultNodeLabel} will be used to set the node's value.\n * @returns {this} the graph, allowing this to be chained with other functions.\n * @remarks Takes `O(1)` time.\n */\n setNode(v, value) {\n if (Object.prototype.hasOwnProperty.call(this._nodes, v)) {\n if (arguments.length > 1) {\n this._nodes[v] = value;\n }\n return this;\n }\n\n this._nodes[v] = arguments.length > 1 ? value : this._defaultNodeLabelFn(v);\n if (this._isCompound) {\n this._parent[v] = GRAPH_NODE;\n this._children[v] = {};\n this._children[GRAPH_NODE][v] = true;\n }\n this._in[v] = {};\n this._preds[v] = {};\n this._out[v] = {};\n this._sucs[v] = {};\n ++this._nodeCount;\n return this;\n }\n\n /**\n * Gets the label of node with specified name.\n *\n * @param {NodeID | number} v - Node ID.\n * @returns {NodeLabel | undefined} the label assigned to the node with the id `v`\n * if it is in the graph.\n * Otherwise returns `undefined`.\n * @remarks Takes `O(1)` time.\n */\n node(v) {\n return this._nodes[v];\n }\n\n /**\n * Detects whether graph has a node with specified name or not.\n *\n * @param {NodeID | number} v - Node ID.\n * @returns {boolean} Returns `true` the graph has a node with the id.\n * @remarks Takes `O(1)` time.\n */\n hasNode(v) {\n return Object.prototype.hasOwnProperty.call(this._nodes, v);\n }\n\n /**\n * Remove the node with the id `v` in the graph or do nothing if the node is\n * not in the graph.\n *\n * If the node was removed this function also removes any incident edges.\n *\n * @param {NodeID | number} v - Node ID to remove.\n * @returns {this} the graph, allowing this to be chained with other functions.\n * @remarks Takes `O(|E|)` time.\n */\n removeNode(v) {\n if (Object.prototype.hasOwnProperty.call(this._nodes, v)) {\n var removeEdge = (e) => this.removeEdge(this._edgeObjs[e]);\n delete this._nodes[v];\n if (this._isCompound) {\n this._removeFromParentsChildList(v);\n delete this._parent[v];\n _.each(this.children(v), (child) => {\n this.setParent(child);\n });\n delete this._children[v];\n }\n _.each(_.keys(this._in[v]), removeEdge);\n delete this._in[v];\n delete this._preds[v];\n _.each(_.keys(this._out[v]), removeEdge);\n delete this._out[v];\n delete this._sucs[v];\n --this._nodeCount;\n }\n return this;\n }\n\n /**\n * Sets the parent for `v` to `parent` if it is defined or removes the parent\n * for `v` if `parent` is undefined.\n *\n * @param {NodeID | number} v - Node ID to set the parent for.\n * @param {NodeID | number} [parent] - Parent node ID. If not defined, removes the parent.\n * @returns {this} the graph, allowing this to be chained with other functions.\n * @throws if the graph is not compound.\n * @throws if setting the parent would create a cycle.\n * @remarks Takes `O(1)` time.\n */\n setParent(v, parent) {\n if (!this._isCompound) {\n throw new Error('Cannot set parent in a non-compound graph');\n }\n\n if (_.isUndefined(parent)) {\n parent = GRAPH_NODE;\n } else {\n // Coerce parent to string\n parent += '';\n for (var ancestor = parent; !_.isUndefined(ancestor); ancestor = this.parent(ancestor)) {\n if (ancestor === v) {\n throw new Error('Setting ' + parent + ' as parent of ' + v + ' would create a cycle');\n }\n }\n\n this.setNode(parent);\n }\n\n this.setNode(v);\n this._removeFromParentsChildList(v);\n // @ts-expect-error -- We coerced parent to a string above\n this._parent[v] = parent;\n this._children[parent][v] = true;\n return this;\n }\n\n /**\n * @private\n * @param {NodeID | number} v - Node ID.\n */\n _removeFromParentsChildList(v) {\n delete this._children[this._parent[v]][v];\n }\n\n /**\n * Get parent node for node `v`.\n *\n * @param {NodeID | number} v - Node ID.\n * @returns {NodeID | undefined} the node that is a parent of node `v`\n * or `undefined` if node `v` does not have a parent or is not a member of\n * the graph.\n * Always returns `undefined` for graphs that are not compound.\n * @remarks Takes `O(1)` time.\n */\n parent(v) {\n if (this._isCompound) {\n var parent = this._parent[v];\n if (parent !== GRAPH_NODE) {\n return parent;\n }\n }\n }\n\n /**\n * Gets list of direct children of node v.\n *\n * @param {NodeID | number} [v] - Node ID. If not specified, gets nodes\n * with no parent (top-level nodes).\n * @returns {NodeID[] | undefined} all nodes that are children of node `v` or\n * `undefined` if node `v` is not in the graph.\n * Always returns `[]` for graphs that are not compound.\n * @remarks Takes `O(|V|)` time.\n */\n children(v) {\n if (_.isUndefined(v)) {\n v = GRAPH_NODE;\n }\n\n if (this._isCompound) {\n var children = this._children[v];\n if (children) {\n return _.keys(children);\n }\n } else if (v === GRAPH_NODE) {\n return this.nodes();\n } else if (this.hasNode(v)) {\n return [];\n }\n }\n\n /**\n * @param {NodeID | number} v - Node ID.\n * @returns {NodeID[] | undefined} all nodes that are predecessors of the\n * specified node or `undefined` if node `v` is not in the graph.\n * @remarks\n * Behavior is undefined for undirected graphs - use {@link neighbors} instead.\n * Takes `O(|V|)` time.\n */\n predecessors(v) {\n var predsV = this._preds[v];\n if (predsV) {\n return _.keys(predsV);\n }\n }\n\n /**\n * @param {NodeID | number} v - Node ID.\n * @returns {NodeID[] | undefined} all nodes that are successors of the\n * specified node or `undefined` if node `v` is not in the graph.\n * @remarks\n * Behavior is undefined for undirected graphs - use {@link neighbors} instead.\n * Takes `O(|V|)` time.\n */\n successors(v) {\n var sucsV = this._sucs[v];\n if (sucsV) {\n return _.keys(sucsV);\n }\n }\n\n /**\n * @param {NodeID | number} v - Node ID.\n * @returns {NodeID[] | undefined} all nodes that are predecessors or\n * successors of the specified node\n * or `undefined` if node `v` is not in the graph.\n * @remarks Takes `O(|V|)` time.\n */\n neighbors(v) {\n var preds = this.predecessors(v);\n if (preds) {\n return _.union(preds, this.successors(v));\n }\n }\n\n /**\n * @param {NodeID | number} v - Node ID.\n * @returns {boolean} True if the node is a leaf (has no successors), false otherwise.\n */\n isLeaf(v) {\n var neighbors;\n if (this.isDirected()) {\n neighbors = this.successors(v);\n } else {\n neighbors = this.neighbors(v);\n }\n return neighbors.length === 0;\n }\n\n /**\n * Creates new graph with nodes filtered via `filter`.\n * Edges incident to rejected node\n * are also removed.\n * \n * In case of compound graph, if parent is rejected by `filter`,\n * than all its children are rejected too.\n\n * @param {(v: NodeID) => boolean} filter - Function that returns `true` for nodes to keep.\n * @returns {Graph<GraphLabel, NodeLabel, EdgeLabel>} A new graph containing only the nodes for which `filter` returns `true`.\n * @remarks Average-case complexity: O(|E|+|V|).\n */\n filterNodes(filter) {\n /**\n * @type {Graph<GraphLabel, NodeLabel, EdgeLabel>}\n */\n // @ts-expect-error\n var copy = new this.constructor({\n directed: this._isDirected,\n multigraph: this._isMultigraph,\n compound: this._isCompound,\n });\n\n copy.setGraph(this.graph());\n\n var self = this;\n _.each(this._nodes, function (value, v) {\n if (filter(v)) {\n copy.setNode(v, value);\n }\n });\n\n _.each(this._edgeObjs, function (e) {\n if (copy.hasNode(e.v) && copy.hasNode(e.w)) {\n copy.setEdge(e, self.edge(e));\n }\n });\n\n var parents = {};\n function findParent(v) {\n var parent = self.parent(v);\n if (parent === undefined || copy.hasNode(parent)) {\n parents[v] = parent;\n return parent;\n } else if (parent in parents) {\n return parents[parent];\n } else {\n return findParent(parent);\n }\n }\n\n if (this._isCompound) {\n _.each(copy.nodes(), function (v) {\n copy.setParent(v, findParent(v));\n });\n }\n\n return copy;\n }\n\n /* === Edge functions ========== */\n\n /**\n * Sets a new default value that is assigned to edges that are created without\n * a label.\n *\n * @param {typeof this._defaultEdgeLabelFn | EdgeLabel} newDefault - If a function,\n * it is called with the parameters `(v, w, name)`.\n * Otherwise, it is assigned as the label directly.\n * @returns {this}\n */\n setDefaultEdgeLabel(newDefault) {\n if (!_.isFunction(newDefault)) {\n newDefault = _.constant(newDefault);\n }\n this._defaultEdgeLabelFn = newDefault;\n return this;\n }\n\n /**\n * @returns {number} the number of edges in the graph.\n * @remarks Complexity: O(1).\n */\n edgeCount() {\n return this._edgeCount;\n }\n\n /**\n * Gets edges of the graph.\n *\n * @returns {EdgeObj[]} the {@link EdgeObj} for each edge in the graph.\n *\n * @remarks\n * In case of compound graph subgraphs are not considered.\n * Use {@link edge()} to get the label for each edge.\n * Takes `O(|E|)` time.\n */\n edges() {\n return _.values(this._edgeObjs);\n }\n\n /**\n * Establish an edges path over the nodes in nodes list.\n *\n * If some edge is already exists, it will update its label, otherwise it will\n * create an edge between pair of nodes with label provided or default label\n * if no label provided.\n *\n * @param {Collection<NodeID>} vs - List of node IDs to create edges between.\n * @param {EdgeLabel} [value] - If set, update all edges with this value.\n * @returns {this}\n * @remarks Complexity: O(|nodes|).\n */\n setPath(vs, value) {\n var self = this;\n var args = arguments;\n _.reduce(vs, function (v, w) {\n if (args.length > 1) {\n self.setEdge(v, w, value);\n } else {\n self.setEdge(v, w);\n }\n return w;\n });\n return this;\n }\n\n /**\n * Creates or updates the label for the edge (`v`, `w`) with the optionally\n * supplied `name`.\n *\n * @overload\n * @param {EdgeObj} arg0 - Edge object.\n * @param {EdgeLabel} [value] - If supplied, it is set as the label for the edge.\n * If not supplied and the edge was created by this call then\n * {@link setDefaultEdgeLabel} will be used to assign the edge's label.\n * @returns {this} the graph, allowing this to be chained with other functions.\n * @remarks Takes `O(1)` time.\n */\n /**\n * Creates or updates the label for the edge (`v`, `w`) with the optionally\n * supplied `name`.\n *\n * @overload\n * @param {NodeID | number} v - Source node ID. Number values will be coerced to strings.\n * @param {NodeID | number} w - Target node ID. Number values will be coerced to strings.\n * @param {EdgeLabel} [value] - If supplied, it is set as the label for the edge.\n * If not supplied and the edge was created by this call then\n * {@link setDefaultEdgeLabel} will be used to assign the edge's label.\n * @param {string | number} [name] - Edge name. Only useful with multigraphs.\n * @returns {this} the graph, allowing this to be chained with other functions.\n * @remarks Takes `O(1)` time.\n */\n setEdge() {\n var v, w, name, value;\n var valueSpecified = false;\n var arg0 = arguments[0];\n\n if (typeof arg0 === 'object' && arg0 !== null && 'v' in arg0) {\n v = arg0.v;\n w = arg0.w;\n name = arg0.name;\n if (arguments.length === 2) {\n value = arguments[1];\n valueSpecified = true;\n }\n } else {\n v = arg0;\n w = arguments[1];\n name = arguments[3];\n if (arguments.length > 2) {\n value = arguments[2];\n valueSpecified = true;\n }\n }\n\n v = '' + v;\n w = '' + w;\n if (!_.isUndefined(name)) {\n name = '' + name;\n }\n\n var e = edgeArgsToId(this._isDirected, v, w, name);\n if (Object.prototype.hasOwnProperty.call(this._edgeLabels, e)) {\n if (valueSpecified) {\n this._edgeLabels[e] = value;\n }\n return this;\n }\n\n if (!_.isUndefined(name) && !this._isMultigraph) {\n throw new Error('Cannot set a named edge when isMultigraph = false');\n }\n\n // It didn't exist, so we need to create it.\n // First ensure the nodes exist.\n this.setNode(v);\n this.setNode(w);\n\n this._edgeLabels[e] = valueSpecified ? value : this._defaultEdgeLabelFn(v, w, name);\n\n var edgeObj = edgeArgsToObj(this._isDirected, v, w, name);\n // Ensure we add undirected edges in a consistent way.\n v = edgeObj.v;\n w = edgeObj.w;\n\n Object.freeze(edgeObj);\n this._edgeObjs[e] = edgeObj;\n incrementOrInitEntry(this._preds[w], v);\n incrementOrInitEntry(this._sucs[v], w);\n this._in[w][e] = edgeObj;\n this._out[v][e] = edgeObj;\n this._edgeCount++;\n return this;\n }\n\n /**\n * Gets the label for the specified edge.\n *\n * @overload\n * @param {EdgeObj} v - Edge object.\n * @returns {EdgeLabel | undefined} the label for the edge (`v`, `w`) if the\n * graph has an edge between `v` and `w` with the optional `name`.\n * Returned `undefined` if there is no such edge in the graph.\n * @remarks\n * `v` and `w` can be interchanged for undirected graphs.\n * Takes `O(1)` time.\n */\n /**\n * Gets the label for the specified edge.\n *\n * @overload\n * @param {NodeID | number} v - Source node ID.\n * @param {NodeID | number} w - Target node ID.\n * @param {string | number} [name] - Edge name. Only useful with multigraphs.\n * @returns {EdgeLabel | undefined} the label for the edge (`v`, `w`) if the\n * graph has an edge between `v` and `w` with the optional `name`.\n * Returned `undefined` if there is no such edge in the graph.\n * @remarks\n * `v` and `w` can be interchanged for undirected graphs.\n * Takes `O(1)` time.\n */\n edge(v, w, name) {\n var e =\n arguments.length === 1\n ? edgeObjToId(this._isDirected, arguments[0])\n : edgeArgsToId(this._isDirected, v, w, name);\n return this._edgeLabels[e];\n }\n\n /**\n * Detects whether the graph contains specified edge or not.\n *\n * @overload\n * @param {EdgeObj} v - Edge object.\n * @returns {boolean} `true` if the graph has an edge between `v` and `w`\n * with the optional `name`.\n * @remarks\n * `v` and `w` can be interchanged for undirected graphs.\n * No subgraphs are considered.\n * Takes `O(1)` time.\n */\n /**\n * Detects whether the graph contains specified edge or not.\n *\n * @overload\n * @param {NodeID | number} v - Source node ID.\n * @param {NodeID | number} w - Target node ID.\n * @param {string | number} [name] - Edge name. Only useful with multigraphs.\n * @returns {boolean} `true` if the graph has an edge between `v` and `w`\n * with the optional `name`.\n * @remarks\n * `v` and `w` can be interchanged for undirected graphs.\n * No subgraphs are considered.\n * Takes `O(1)` time.\n */\n hasEdge(v, w, name) {\n var e =\n arguments.length === 1\n ? edgeObjToId(this._isDirected, arguments[0])\n : edgeArgsToId(this._isDirected, v, w, name);\n return Object.prototype.hasOwnProperty.call(this._edgeLabels, e);\n }\n\n /**\n * Removes the edge (`v`, `w`) if the graph has an edge between `v` and `w`\n * with the optional `name`. If not this function does nothing.\n *\n * @overload\n * @param {EdgeObj} v - Edge object.\n * @returns {this}\n * @remarks\n * `v` and `w` can be interchanged for undirected graphs.\n * No subgraphs are considered.\n * Takes `O(1)` time.\n */\n /**\n * Removes the edge (`v`, `w`) if the graph has an edge between `v` and `w`\n * with the optional `name`. If not this function does nothing.\n *\n * @overload\n * @param {NodeID | number} v - Source node ID.\n * @param {NodeID | number} w - Target node ID.\n * @param {string | number} [name] - Edge name. Only useful with multigraphs.\n * @returns {this}\n * @remarks\n * `v` and `w` can be interchanged for undirected graphs.\n * Takes `O(1)` time.\n */\n removeEdge(v, w, name) {\n var e =\n arguments.length === 1\n ? edgeObjToId(this._isDirected, arguments[0])\n : edgeArgsToId(this._isDirected, v, w, name);\n var edge = this._edgeObjs[e];\n if (edge) {\n v = edge.v;\n w = edge.w;\n delete this._edgeLabels[e];\n delete this._edgeObjs[e];\n decrementOrRemoveEntry(this._preds[w], v);\n decrementOrRemoveEntry(this._sucs[v], w);\n delete this._in[w][e];\n delete this._out[v][e];\n this._edgeCount--;\n }\n return this;\n }\n\n /**\n * @param {NodeID | number} v - Target node ID.\n * @param {NodeID | number} [u] - Optionally filters edges down to just those\n * coming from node `u`.\n * @returns {EdgeObj[] | undefined} all edges that point to the node `v`.\n * Returns `undefined` if node `v` is not in the graph.\n * @remarks\n * Behavior is undefined for undirected graphs - use {@link nodeEdges} instead.\n * Takes `O(|E|)` time.\n */\n inEdges(v, u) {\n var inV = this._in[v];\n if (inV) {\n var edges = _.values(inV);\n if (!u) {\n return edges;\n }\n return _.filter(edges, function (edge) {\n return edge.v === u;\n });\n }\n }\n\n /**\n * @param {NodeID | number} v - Target node ID.\n * @param {NodeID | number} [w] - Optionally filters edges down to just those\n * that point to `w`.\n * @returns {EdgeObj[] | undefined} all edges that point to the node `v`.\n * Returns `undefined` if node `v` is not in the graph.\n * @remarks\n * Behavior is undefined for undirected graphs - use {@link nodeEdges} instead.\n * Takes `O(|E|)` time.\n */\n outEdges(v, w) {\n var outV = this._out[v];\n if (outV) {\n var edges = _.values(outV);\n if (!w) {\n return edges;\n }\n return _.filter(edges, function (edge) {\n return edge.w === w;\n });\n }\n }\n\n /**\n * @param {NodeID | number} v - Target Node ID.\n * @param {NodeID | number} [w] - If set, filters those edges down to just\n * those between nodes `v` and `w` regardless of direction\n * @returns {EdgeObj[] | undefined} all edges to or from node `v` regardless\n * of direction. Returns `undefined` if node `v` is not in the graph.\n * @remarks Takes `O(|E|)` time.\n */\n nodeEdges(v, w) {\n var inEdges = this.inEdges(v, w);\n if (inEdges) {\n return inEdges.concat(this.outEdges(v, w));\n }\n }\n}\n\n/* Number of nodes in the graph. Should only be changed by the implementation. */\nGraph.prototype._nodeCount = 0;\n\n/* Number of edges in the graph. Should only be changed by the implementation. */\nGraph.prototype._edgeCount = 0;\n\n/**\n * @param {Record<NodeID, number>} map - Object mapping node IDs to counts.\n * @param {NodeID | number} k - Node ID.\n */\nfunction incrementOrInitEntry(map, k) {\n if (map[k]) {\n map[k]++;\n } else {\n map[k] = 1;\n }\n}\n\n/**\n * @param {Record<NodeID, number>} map - Object mapping node IDs to counts.\n * @param {NodeID | number} k - Node ID.\n */\nfunction decrementOrRemoveEntry(map, k) {\n if (!--map[k]) {\n delete map[k];\n }\n}\n\n/**\n * @param {boolean} isDirected - If `false`, sorts v and w to ensure a consistent ID.\n * @param {EdgeObj['v'] | number} v_ - Source node ID.\n * @param {EdgeObj['w'] | number} w_ - Target node ID.\n * @param {EdgeObj['name']} [name] - Edge name (for multiple edges between the same nodes).\n * @returns {EdgeID} Unique ID for the edge.\n */\nfunction edgeArgsToId(isDirected, v_, w_, name) {\n var v = '' + v_;\n var w = '' + w_;\n if (!isDirected && v > w) {\n var tmp = v;\n v = w;\n w = tmp;\n }\n return v + EDGE_KEY_DELIM + w + EDGE_KEY_DELIM + (_.isUndefined(name) ? DEFAULT_EDGE_NAME : name);\n}\n\n/**\n * @param {boolean} isDirected - If `false`, sorts v and w to ensure a consistent ID.\n * @param {EdgeObj['v'] | number} v_ - Source node ID.\n * @param {EdgeObj['w'] | number} w_ - Target node ID.\n * @param {EdgeObj['name']} [name] - Edge name (for multiple edges between the same nodes).\n * @returns {EdgeObj}\n */\nfunction edgeArgsToObj(isDirected, v_, w_, name) {\n var v = '' + v_;\n var w = '' + w_;\n if (!isDirected && v > w) {\n var tmp = v;\n v = w;\n w = tmp;\n }\n var edgeObj = { v: v, w: w };\n if (name) {\n edgeObj.name = name;\n }\n return edgeObj;\n}\n\n/**\n * @param {boolean} isDirected - If `false`, sorts v and w to ensure a consistent ID.\n * @param {EdgeObj} edgeObj - Edge object.\n * @returns {EdgeID} Unique ID for the edge.\n */\nfunction edgeObjToId(isDirected, edgeObj) {\n return edgeArgsToId(isDirected, edgeObj.v, edgeObj.w, edgeObj.name);\n}\n"],
|
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAEA,IAAI,oBAAoB;AACxB,IAAI,aAAa;AACjB,IAAI,iBAAiB;AAiMd,IAAM,QAAN,MAAY;AAAA,EArMnB,OAqMmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAIjB,YAAY,OAAO,CAAC,GAAG;AAKrB,SAAK,cAAc,OAAO,UAAU,eAAe,KAAK,MAAM,U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