8 lines
44 KiB
Plaintext
8 lines
44 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": "qNAEA,IAAIA,EAAoB,KACpBC,EAAa,KACbC,EAAiB,IAiMRC,EAAN,KAAY,CArMnB,MAqMmB,CAAAC,EAAA,cAIjB,YAAYC,EAAO,CAAC,EAAG,CAKrB,KAAK,YAAc,OAAO,UAAU,eAAe,KAAKA,EAAM,UAAU,EACpEA,EAAK,SACL,GAKJ,KAAK,cAAgB,OAAO,UAAU,eAAe,KAAKA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AKoB,EACb,GAAI,CAACF,GAAc1C,EAAIwB,EAAG,CACxB,IAAIqB,EAAM7C,EACVA,EAAIwB,EACJA,EAAIqB,CACN,CACA,OAAO7C,EAAIX,EAAiBmC,EAAInC,GAAoBqB,EAAYe,CAAI,EAAItC,EAAoBsC,EAC9F,CATSlC,EAAAqC,EAAA,gBAkBT,SAASE,EAAcY,EAAYC,EAAIC,EAAInB,EAAM,CAC/C,IAAIzB,EAAI,GAAK2C,EACTnB,EAAI,GAAKoB,EACb,GAAI,CAACF,GAAc1C,EAAIwB,EAAG,CACxB,IAAIqB,EAAM7C,EACVA,EAAIwB,EACJA,EAAIqB,CACN,CACA,IAAIhB,EAAU,CAAE,EAAG7B,EAAG,EAAGwB,CAAE,EAC3B,OAAIC,IACFI,EAAQ,KAAOJ,GAEVI,CACT,CAbStC,EAAAuC,EAAA,iBAoBT,SAASE,EAAYU,EAAYb,EAAS,CACxC,OAAOD,EAAac,EAAYb,EAAQ,EAAGA,EAAQ,EAAGA,EAAQ,IAAI,CACpE,CAFStC,EAAAyC,EAAA",
|
|
"names": ["DEFAULT_EDGE_NAME", "GRAPH_NODE", "EDGE_KEY_DELIM", "Graph", "__name", "opts", "constant_default", "label", "newDefault", "isFunction_default", "keys_default", "self", "filter_default", "v", "isEmpty_default", "vs", "value", "args", "forEach_default", "removeEdge", "e", "child", "parent", "isUndefined_default", "ancestor", "children", "predsV", "sucsV", "preds", "union_default", "neighbors", "filter", "copy", "parents", "findParent", "values_default", "reduce_default", "w", "name", "valueSpecified", "arg0", "edgeArgsToId", "edgeObj", "edgeArgsToObj", "incrementOrInitEntry", "edgeObjToId", "edge", "decrementOrRemoveEntry", "u", "inV", "edges", "outV", "inEdges", "map", "k", "isDirected", "v_", "w_", "tmp"]
|
|
}
|