MCPcopy Create free account
hub / github.com/p2r3/convert / getData

Method getData

src/TraversionGraph.ts:297–309  ·  view source on GitHub ↗

* 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.

()

Source from the content-addressed store, hash-verified

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 */

Callers

nothing calls this directly

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected