{"ast":null,"code":"/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js'; // id may be function name of Object, add a prefix to avoid this problem.\n\nfunction generateNodeKey(id) {\n return '_EC_' + id;\n}\n\nvar Graph =\n/** @class */\nfunction () {\n function Graph(directed) {\n this.type = 'graph';\n this.nodes = [];\n this.edges = [];\n this._nodesMap = {};\n /**\n * @type {Object.}\n * @private\n */\n\n this._edgesMap = {};\n this._directed = directed || false;\n }\n /**\n * If is directed graph\n */\n\n\n Graph.prototype.isDirected = function () {\n return this._directed;\n };\n\n ;\n /**\n * Add a new node\n */\n\n Graph.prototype.addNode = function (id, dataIndex) {\n id = id == null ? '' + dataIndex : '' + id;\n var nodesMap = this._nodesMap;\n\n if (nodesMap[generateNodeKey(id)]) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Graph nodes have duplicate name or id');\n }\n\n return;\n }\n\n var node = new GraphNode(id, dataIndex);\n node.hostGraph = this;\n this.nodes.push(node);\n nodesMap[generateNodeKey(id)] = node;\n return node;\n };\n\n ;\n /**\n * Get node by data index\n */\n\n Graph.prototype.getNodeByIndex = function (dataIndex) {\n var rawIdx = this.data.getRawIndex(dataIndex);\n return this.nodes[rawIdx];\n };\n\n ;\n /**\n * Get node by id\n */\n\n Graph.prototype.getNodeById = function (id) {\n return this._nodesMap[generateNodeKey(id)];\n };\n\n ;\n /**\n * Add a new edge\n */\n\n Graph.prototype.addEdge = function (n1, n2, dataIndex) {\n var nodesMap = this._nodesMap;\n var edgesMap = this._edgesMap; // PENDING\n\n if (zrUtil.isNumber(n1)) {\n n1 = this.nodes[n1];\n }\n\n if (zrUtil.isNumber(n2)) {\n n2 = this.nodes[n2];\n }\n\n if (!(n1 instanceof GraphNode)) {\n n1 = nodesMap[generateNodeKey(n1)];\n }\n\n if (!(n2 instanceof GraphNode)) {\n n2 = nodesMap[generateNodeKey(n2)];\n }\n\n if (!n1 || !n2) {\n return;\n }\n\n var key = n1.id + '-' + n2.id;\n var edge = new GraphEdge(n1, n2, dataIndex);\n edge.hostGraph = this;\n\n if (this._directed) {\n n1.outEdges.push(edge);\n n2.inEdges.push(edge);\n }\n\n n1.edges.push(edge);\n\n if (n1 !== n2) {\n n2.edges.push(edge);\n }\n\n this.edges.push(edge);\n edgesMap[key] = edge;\n return edge;\n };\n\n ;\n /**\n * Get edge by data index\n */\n\n Graph.prototype.getEdgeByIndex = function (dataIndex) {\n var rawIdx = this.edgeData.getRawIndex(dataIndex);\n return this.edges[rawIdx];\n };\n\n ;\n /**\n * Get edge by two linked nodes\n */\n\n Graph.prototype.getEdge = function (n1, n2) {\n if (n1 instanceof GraphNode) {\n n1 = n1.id;\n }\n\n if (n2 instanceof GraphNode) {\n n2 = n2.id;\n }\n\n var edgesMap = this._edgesMap;\n\n if (this._directed) {\n return edgesMap[n1 + '-' + n2];\n } else {\n return edgesMap[n1 + '-' + n2] || edgesMap[n2 + '-' + n1];\n }\n };\n\n ;\n /**\n * Iterate all nodes\n */\n\n Graph.prototype.eachNode = function (cb, context) {\n var nodes = this.nodes;\n var len = nodes.length;\n\n for (var i = 0; i < len; i++) {\n if (nodes[i].dataIndex >= 0) {\n cb.call(context, nodes[i], i);\n }\n }\n };\n\n ;\n /**\n * Iterate all edges\n */\n\n Graph.prototype.eachEdge = function (cb, context) {\n var edges = this.edges;\n var len = edges.length;\n\n for (var i = 0; i < len; i++) {\n if (edges[i].dataIndex >= 0 && edges[i].node1.dataIndex >= 0 && edges[i].node2.dataIndex >= 0) {\n cb.call(context, edges[i], i);\n }\n }\n };\n\n ;\n /**\n * Breadth first traverse\n * Return true to stop traversing\n */\n\n Graph.prototype.breadthFirstTraverse = function (cb, startNode, direction, context) {\n if (!(startNode instanceof GraphNode)) {\n startNode = this._nodesMap[generateNodeKey(startNode)];\n }\n\n if (!startNode) {\n return;\n }\n\n var edgeType = direction === 'out' ? 'outEdges' : direction === 'in' ? 'inEdges' : 'edges';\n\n for (var i = 0; i < this.nodes.length; i++) {\n this.nodes[i].__visited = false;\n }\n\n if (cb.call(context, startNode, null)) {\n return;\n }\n\n var queue = [startNode];\n\n while (queue.length) {\n var currentNode = queue.shift();\n var edges = currentNode[edgeType];\n\n for (var i = 0; i < edges.length; i++) {\n var e = edges[i];\n var otherNode = e.node1 === currentNode ? e.node2 : e.node1;\n\n if (!otherNode.__visited) {\n if (cb.call(context, otherNode, currentNode)) {\n // Stop traversing\n return;\n }\n\n queue.push(otherNode);\n otherNode.__visited = true;\n }\n }\n }\n };\n\n ; // TODO\n // depthFirstTraverse(\n // cb, startNode, direction, context\n // ) {\n // };\n // Filter update\n\n Graph.prototype.update = function () {\n var data = this.data;\n var edgeData = this.edgeData;\n var nodes = this.nodes;\n var edges = this.edges;\n\n for (var i = 0, len = nodes.length; i < len; i++) {\n nodes[i].dataIndex = -1;\n }\n\n for (var i = 0, len = data.count(); i < len; i++) {\n nodes[data.getRawIndex(i)].dataIndex = i;\n }\n\n edgeData.filterSelf(function (idx) {\n var edge = edges[edgeData.getRawIndex(idx)];\n return edge.node1.dataIndex >= 0 && edge.node2.dataIndex >= 0;\n }); // Update edge\n\n for (var i = 0, len = edges.length; i < len; i++) {\n edges[i].dataIndex = -1;\n }\n\n for (var i = 0, len = edgeData.count(); i < len; i++) {\n edges[edgeData.getRawIndex(i)].dataIndex = i;\n }\n };\n\n ;\n /**\n * @return {module:echarts/data/Graph}\n */\n\n Graph.prototype.clone = function () {\n var graph = new Graph(this._directed);\n var nodes = this.nodes;\n var edges = this.edges;\n\n for (var i = 0; i < nodes.length; i++) {\n graph.addNode(nodes[i].id, nodes[i].dataIndex);\n }\n\n for (var i = 0; i < edges.length; i++) {\n var e = edges[i];\n graph.addEdge(e.node1.id, e.node2.id, e.dataIndex);\n }\n\n return graph;\n };\n\n ;\n return Graph;\n}();\n\nvar GraphNode =\n/** @class */\nfunction () {\n function GraphNode(id, dataIndex) {\n this.inEdges = [];\n this.outEdges = [];\n this.edges = [];\n this.dataIndex = -1;\n this.id = id == null ? '' : id;\n this.dataIndex = dataIndex == null ? -1 : dataIndex;\n }\n /**\n * @return {number}\n */\n\n\n GraphNode.prototype.degree = function () {\n return this.edges.length;\n };\n /**\n * @return {number}\n */\n\n\n GraphNode.prototype.inDegree = function () {\n return this.inEdges.length;\n };\n /**\n * @return {number}\n */\n\n\n GraphNode.prototype.outDegree = function () {\n return this.outEdges.length;\n };\n\n GraphNode.prototype.getModel = function (path) {\n if (this.dataIndex < 0) {\n return;\n }\n\n var graph = this.hostGraph;\n var itemModel = graph.data.getItemModel(this.dataIndex);\n return itemModel.getModel(path);\n };\n\n GraphNode.prototype.getAdjacentDataIndices = function () {\n var dataIndices = {\n edge: [],\n node: []\n };\n\n for (var i = 0; i < this.edges.length; i++) {\n var adjacentEdge = this.edges[i];\n\n if (adjacentEdge.dataIndex < 0) {\n continue;\n }\n\n dataIndices.edge.push(adjacentEdge.dataIndex);\n dataIndices.node.push(adjacentEdge.node1.dataIndex, adjacentEdge.node2.dataIndex);\n }\n\n return dataIndices;\n };\n\n return GraphNode;\n}();\n\nvar GraphEdge =\n/** @class */\nfunction () {\n function GraphEdge(n1, n2, dataIndex) {\n this.dataIndex = -1;\n this.node1 = n1;\n this.node2 = n2;\n this.dataIndex = dataIndex == null ? -1 : dataIndex;\n } // eslint-disable-next-line @typescript-eslint/no-unused-vars\n\n\n GraphEdge.prototype.getModel = function (path) {\n if (this.dataIndex < 0) {\n return;\n }\n\n var graph = this.hostGraph;\n var itemModel = graph.edgeData.getItemModel(this.dataIndex);\n return itemModel.getModel(path);\n };\n\n GraphEdge.prototype.getAdjacentDataIndices = function () {\n return {\n edge: [this.dataIndex],\n node: [this.node1.dataIndex, this.node2.dataIndex]\n };\n };\n\n return GraphEdge;\n}();\n\nfunction createGraphDataProxyMixin(hostName, dataName) {\n return {\n /**\n * @param Default 'value'. can be 'a', 'b', 'c', 'd', 'e'.\n */\n getValue: function getValue(dimension) {\n var data = this[hostName][dataName];\n return data.getStore().get(data.getDimensionIndex(dimension || 'value'), this.dataIndex);\n },\n // TODO: TYPE stricter type.\n setVisual: function setVisual(key, value) {\n this.dataIndex >= 0 && this[hostName][dataName].setItemVisual(this.dataIndex, key, value);\n },\n getVisual: function getVisual(key) {\n return this[hostName][dataName].getItemVisual(this.dataIndex, key);\n },\n setLayout: function setLayout(layout, merge) {\n this.dataIndex >= 0 && this[hostName][dataName].setItemLayout(this.dataIndex, layout, merge);\n },\n getLayout: function getLayout() {\n return this[hostName][dataName].getItemLayout(this.dataIndex);\n },\n getGraphicEl: function getGraphicEl() {\n return this[hostName][dataName].getItemGraphicEl(this.dataIndex);\n },\n getRawIndex: function getRawIndex() {\n return this[hostName][dataName].getRawIndex(this.dataIndex);\n }\n };\n}\n\n;\n;\n;\nzrUtil.mixin(GraphNode, createGraphDataProxyMixin('hostGraph', 'data'));\nzrUtil.mixin(GraphEdge, createGraphDataProxyMixin('hostGraph', 'edgeData'));\nexport default Graph;\nexport { GraphNode, GraphEdge };","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/ElectronicMallVue/node_modules/echarts/lib/data/Graph.js"],"names":["zrUtil","generateNodeKey","id","Graph","directed","type","nodes","edges","_nodesMap","_edgesMap","_directed","prototype","isDirected","addNode","dataIndex","nodesMap","process","env","NODE_ENV","console","error","node","GraphNode","hostGraph","push","getNodeByIndex","rawIdx","data","getRawIndex","getNodeById","addEdge","n1","n2","edgesMap","isNumber","key","edge","GraphEdge","outEdges","inEdges","getEdgeByIndex","edgeData","getEdge","eachNode","cb","context","len","length","i","call","eachEdge","node1","node2","breadthFirstTraverse","startNode","direction","edgeType","__visited","queue","currentNode","shift","e","otherNode","update","count","filterSelf","idx","clone","graph","degree","inDegree","outDegree","getModel","path","itemModel","getItemModel","getAdjacentDataIndices","dataIndices","adjacentEdge","createGraphDataProxyMixin","hostName","dataName","getValue","dimension","getStore","get","getDimensionIndex","setVisual","value","setItemVisual","getVisual","getItemVisual","setLayout","layout","merge","setItemLayout","getLayout","getItemLayout","getGraphicEl","getItemGraphicEl","mixin"],"mappings":"AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,MAAZ,MAAwB,0BAAxB,C,CAAoD;;AAEpD,SAASC,eAAT,CAAyBC,EAAzB,EAA6B;AAC3B,SAAO,SAASA,EAAhB;AACD;;AAED,IAAIC,KAAK;AACT;AACA,YAAY;AACV,WAASA,KAAT,CAAeC,QAAf,EAAyB;AACvB,SAAKC,IAAL,GAAY,OAAZ;AACA,SAAKC,KAAL,GAAa,EAAb;AACA,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,EAAE,mBAAUC,MAAV,EAAkBC,KAAlB,EAAyB;AAClC,WAAKhF,SAAL,IAAkB,CAAlB,IAAuB,KAAKkE,QAAL,EAAeC,QAAf,EAAyBc,aAAzB,CAAuC,KAAKjF,SAA5C,EAAuD+E,MAAvD,EAA+DC,KAA/D,CAAvB;AACD,KAjBI;AAkBLE,IAAAA,SAAS,EAAE,qBAAY;AACrB,aAAO,KAAKhB,QAAL,EAAeC,QAAf,EAAyBgB,aAAzB,CAAuC,KAAKnF,SAA5C,CAAP;AACD,KApBI;AAqBLoF,IAAAA,YAAY,EAAE,wBAAY;AACxB,aAAO,KAAKlB,QAAL,EAAeC,QAAf,EAAyBkB,gBAAzB,CAA0C,KAAKrF,SAA/C,CAAP;AACD,KAvBI;AAwBLc,IAAAA,WAAW,EAAE,uBAAY;AACvB,aAAO,KAAKoD,QAAL,EAAeC,QAAf,EAAyBrD,WAAzB,CAAqC,KAAKd,SAA1C,CAAP;AACD;AA1BI,GAAP;AA4BD;;AAED;AACA;AACA;AACAd,MAAM,CAACoG,KAAP,CAAa9E,SAAb,EAAwByD,yBAAyB,CAAC,WAAD,EAAc,MAAd,CAAjD;AACA/E,MAAM,CAACoG,KAAP,CAAa/D,SAAb,EAAwB0C,yBAAyB,CAAC,WAAD,EAAc,UAAd,CAAjD;AACA,eAAe5E,KAAf;AACA,SAASmB,SAAT,EAAoBe,SAApB","sourcesContent":["\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util.js'; // id may be function name of Object, add a prefix to avoid this problem.\n\nfunction generateNodeKey(id) {\n return '_EC_' + id;\n}\n\nvar Graph =\n/** @class */\nfunction () {\n function Graph(directed) {\n this.type = 'graph';\n this.nodes = [];\n this.edges = [];\n this._nodesMap = {};\n /**\n * @type {Object.}\n * @private\n */\n\n this._edgesMap = {};\n this._directed = directed || false;\n }\n /**\n * If is directed graph\n */\n\n\n Graph.prototype.isDirected = function () {\n return this._directed;\n };\n\n ;\n /**\n * Add a new node\n */\n\n Graph.prototype.addNode = function (id, dataIndex) {\n id = id == null ? '' + dataIndex : '' + id;\n var nodesMap = this._nodesMap;\n\n if (nodesMap[generateNodeKey(id)]) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Graph nodes have duplicate name or id');\n }\n\n return;\n }\n\n var node = new GraphNode(id, dataIndex);\n node.hostGraph = this;\n this.nodes.push(node);\n nodesMap[generateNodeKey(id)] = node;\n return node;\n };\n\n ;\n /**\n * Get node by data index\n */\n\n Graph.prototype.getNodeByIndex = function (dataIndex) {\n var rawIdx = this.data.getRawIndex(dataIndex);\n return this.nodes[rawIdx];\n };\n\n ;\n /**\n * Get node by id\n */\n\n Graph.prototype.getNodeById = function (id) {\n return this._nodesMap[generateNodeKey(id)];\n };\n\n ;\n /**\n * Add a new edge\n */\n\n Graph.prototype.addEdge = function (n1, n2, dataIndex) {\n var nodesMap = this._nodesMap;\n var edgesMap = this._edgesMap; // PENDING\n\n if (zrUtil.isNumber(n1)) {\n n1 = this.nodes[n1];\n }\n\n if (zrUtil.isNumber(n2)) {\n n2 = this.nodes[n2];\n }\n\n if (!(n1 instanceof GraphNode)) {\n n1 = nodesMap[generateNodeKey(n1)];\n }\n\n if (!(n2 instanceof GraphNode)) {\n n2 = nodesMap[generateNodeKey(n2)];\n }\n\n if (!n1 || !n2) {\n return;\n }\n\n var key = n1.id + '-' + n2.id;\n var edge = new GraphEdge(n1, n2, dataIndex);\n edge.hostGraph = this;\n\n if (this._directed) {\n n1.outEdges.push(edge);\n n2.inEdges.push(edge);\n }\n\n n1.edges.push(edge);\n\n if (n1 !== n2) {\n n2.edges.push(edge);\n }\n\n this.edges.push(edge);\n edgesMap[key] = edge;\n return edge;\n };\n\n ;\n /**\n * Get edge by data index\n */\n\n Graph.prototype.getEdgeByIndex = function (dataIndex) {\n var rawIdx = this.edgeData.getRawIndex(dataIndex);\n return this.edges[rawIdx];\n };\n\n ;\n /**\n * Get edge by two linked nodes\n */\n\n Graph.prototype.getEdge = function (n1, n2) {\n if (n1 instanceof GraphNode) {\n n1 = n1.id;\n }\n\n if (n2 instanceof GraphNode) {\n n2 = n2.id;\n }\n\n var edgesMap = this._edgesMap;\n\n if (this._directed) {\n return edgesMap[n1 + '-' + n2];\n } else {\n return edgesMap[n1 + '-' + n2] || edgesMap[n2 + '-' + n1];\n }\n };\n\n ;\n /**\n * Iterate all nodes\n */\n\n Graph.prototype.eachNode = function (cb, context) {\n var nodes = this.nodes;\n var len = nodes.length;\n\n for (var i = 0; i < len; i++) {\n if (nodes[i].dataIndex >= 0) {\n cb.call(context, nodes[i], i);\n }\n }\n };\n\n ;\n /**\n * Iterate all edges\n */\n\n Graph.prototype.eachEdge = function (cb, context) {\n var edges = this.edges;\n var len = edges.length;\n\n for (var i = 0; i < len; i++) {\n if (edges[i].dataIndex >= 0 && edges[i].node1.dataIndex >= 0 && edges[i].node2.dataIndex >= 0) {\n cb.call(context, edges[i], i);\n }\n }\n };\n\n ;\n /**\n * Breadth first traverse\n * Return true to stop traversing\n */\n\n Graph.prototype.breadthFirstTraverse = function (cb, startNode, direction, context) {\n if (!(startNode instanceof GraphNode)) {\n startNode = this._nodesMap[generateNodeKey(startNode)];\n }\n\n if (!startNode) {\n return;\n }\n\n var edgeType = direction === 'out' ? 'outEdges' : direction === 'in' ? 'inEdges' : 'edges';\n\n for (var i = 0; i < this.nodes.length; i++) {\n this.nodes[i].__visited = false;\n }\n\n if (cb.call(context, startNode, null)) {\n return;\n }\n\n var queue = [startNode];\n\n while (queue.length) {\n var currentNode = queue.shift();\n var edges = currentNode[edgeType];\n\n for (var i = 0; i < edges.length; i++) {\n var e = edges[i];\n var otherNode = e.node1 === currentNode ? e.node2 : e.node1;\n\n if (!otherNode.__visited) {\n if (cb.call(context, otherNode, currentNode)) {\n // Stop traversing\n return;\n }\n\n queue.push(otherNode);\n otherNode.__visited = true;\n }\n }\n }\n };\n\n ; // TODO\n // depthFirstTraverse(\n // cb, startNode, direction, context\n // ) {\n // };\n // Filter update\n\n Graph.prototype.update = function () {\n var data = this.data;\n var edgeData = this.edgeData;\n var nodes = this.nodes;\n var edges = this.edges;\n\n for (var i = 0, len = nodes.length; i < len; i++) {\n nodes[i].dataIndex = -1;\n }\n\n for (var i = 0, len = data.count(); i < len; i++) {\n nodes[data.getRawIndex(i)].dataIndex = i;\n }\n\n edgeData.filterSelf(function (idx) {\n var edge = edges[edgeData.getRawIndex(idx)];\n return edge.node1.dataIndex >= 0 && edge.node2.dataIndex >= 0;\n }); // Update edge\n\n for (var i = 0, len = edges.length; i < len; i++) {\n edges[i].dataIndex = -1;\n }\n\n for (var i = 0, len = edgeData.count(); i < len; i++) {\n edges[edgeData.getRawIndex(i)].dataIndex = i;\n }\n };\n\n ;\n /**\n * @return {module:echarts/data/Graph}\n */\n\n Graph.prototype.clone = function () {\n var graph = new Graph(this._directed);\n var nodes = this.nodes;\n var edges = this.edges;\n\n for (var i = 0; i < nodes.length; i++) {\n graph.addNode(nodes[i].id, nodes[i].dataIndex);\n }\n\n for (var i = 0; i < edges.length; i++) {\n var e = edges[i];\n graph.addEdge(e.node1.id, e.node2.id, e.dataIndex);\n }\n\n return graph;\n };\n\n ;\n return Graph;\n}();\n\nvar GraphNode =\n/** @class */\nfunction () {\n function GraphNode(id, dataIndex) {\n this.inEdges = [];\n this.outEdges = [];\n this.edges = [];\n this.dataIndex = -1;\n this.id = id == null ? '' : id;\n this.dataIndex = dataIndex == null ? -1 : dataIndex;\n }\n /**\n * @return {number}\n */\n\n\n GraphNode.prototype.degree = function () {\n return this.edges.length;\n };\n /**\n * @return {number}\n */\n\n\n GraphNode.prototype.inDegree = function () {\n return this.inEdges.length;\n };\n /**\n * @return {number}\n */\n\n\n GraphNode.prototype.outDegree = function () {\n return this.outEdges.length;\n };\n\n GraphNode.prototype.getModel = function (path) {\n if (this.dataIndex < 0) {\n return;\n }\n\n var graph = this.hostGraph;\n var itemModel = graph.data.getItemModel(this.dataIndex);\n return itemModel.getModel(path);\n };\n\n GraphNode.prototype.getAdjacentDataIndices = function () {\n var dataIndices = {\n edge: [],\n node: []\n };\n\n for (var i = 0; i < this.edges.length; i++) {\n var adjacentEdge = this.edges[i];\n\n if (adjacentEdge.dataIndex < 0) {\n continue;\n }\n\n dataIndices.edge.push(adjacentEdge.dataIndex);\n dataIndices.node.push(adjacentEdge.node1.dataIndex, adjacentEdge.node2.dataIndex);\n }\n\n return dataIndices;\n };\n\n return GraphNode;\n}();\n\nvar GraphEdge =\n/** @class */\nfunction () {\n function GraphEdge(n1, n2, dataIndex) {\n this.dataIndex = -1;\n this.node1 = n1;\n this.node2 = n2;\n this.dataIndex = dataIndex == null ? -1 : dataIndex;\n } // eslint-disable-next-line @typescript-eslint/no-unused-vars\n\n\n GraphEdge.prototype.getModel = function (path) {\n if (this.dataIndex < 0) {\n return;\n }\n\n var graph = this.hostGraph;\n var itemModel = graph.edgeData.getItemModel(this.dataIndex);\n return itemModel.getModel(path);\n };\n\n GraphEdge.prototype.getAdjacentDataIndices = function () {\n return {\n edge: [this.dataIndex],\n node: [this.node1.dataIndex, this.node2.dataIndex]\n };\n };\n\n return GraphEdge;\n}();\n\nfunction createGraphDataProxyMixin(hostName, dataName) {\n return {\n /**\n * @param Default 'value'. can be 'a', 'b', 'c', 'd', 'e'.\n */\n getValue: function (dimension) {\n var data = this[hostName][dataName];\n return data.getStore().get(data.getDimensionIndex(dimension || 'value'), this.dataIndex);\n },\n // TODO: TYPE stricter type.\n setVisual: function (key, value) {\n this.dataIndex >= 0 && this[hostName][dataName].setItemVisual(this.dataIndex, key, value);\n },\n getVisual: function (key) {\n return this[hostName][dataName].getItemVisual(this.dataIndex, key);\n },\n setLayout: function (layout, merge) {\n this.dataIndex >= 0 && this[hostName][dataName].setItemLayout(this.dataIndex, layout, merge);\n },\n getLayout: function () {\n return this[hostName][dataName].getItemLayout(this.dataIndex);\n },\n getGraphicEl: function () {\n return this[hostName][dataName].getItemGraphicEl(this.dataIndex);\n },\n getRawIndex: function () {\n return this[hostName][dataName].getRawIndex(this.dataIndex);\n }\n };\n}\n\n;\n;\n;\nzrUtil.mixin(GraphNode, createGraphDataProxyMixin('hostGraph', 'data'));\nzrUtil.mixin(GraphEdge, createGraphDataProxyMixin('hostGraph', 'edgeData'));\nexport default Graph;\nexport { GraphNode, GraphEdge };"]},"metadata":{},"sourceType":"module"}