* Returns a copy of the graph data, including nodes, edges, category change costs, and category adaptive costs. This can be used for debugging, visualization, or analysis purposes. The returned data is a deep copy to prevent external modifications from affecting the internal state of the graph.
()
| 295 | * Returns a copy of the graph data, including nodes, edges, category change costs, and category adaptive costs. This can be used for debugging, visualization, or analysis purposes. The returned data is a deep copy to prevent external modifications from affecting the internal state of the graph. |
| 296 | */ |
| 297 | public getData() : {nodes: Node[], edges: Edge[], categoryChangeCosts: CategoryChangeCost[], categoryAdaptiveCosts: CategoryAdaptiveCost[]} { |
| 298 | return { |
| 299 | nodes: this.nodes.map(node => ({identifier: node.identifier, format: {...node.format}, edges: [...node.edges]})), |
| 300 | edges: this.edges.map(edge => ({ |
| 301 | from: {format: {...edge.from.format}, index: edge.from.index}, |
| 302 | to: {format: {...edge.to.format}, index: edge.to.index}, |
| 303 | handler: edge.handler, |
| 304 | cost: edge.cost |
| 305 | })), |
| 306 | categoryChangeCosts: this.categoryChangeCosts.map(c => ({from: c.from, to: c.to, handler: c.handler, cost: c.cost})), |
| 307 | categoryAdaptiveCosts: this.categoryAdaptiveCosts.map(c => ({categories: [...c.categories], cost: c.cost})) |
| 308 | }; |
| 309 | } |
| 310 | /** |
| 311 | * @coverageIgnore |
| 312 | */ |