UNPKG

@crstrskp/graph

Version:

High-performance TypeScript graph algorithms library optimized for trading bots and arbitrage detection

38 lines 916 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Edge = void 0; class Edge { /** * */ constructor(start, end) { this.start = start; this.end = end; this.cost = -1; } getCost() { if (this.cost !== -1) { return this.cost; } else { if (typeof this.obj === 'number') { return this.obj; } else if (this.obj && typeof this.obj.getCost === 'function') { return this.obj.getCost(); } else { return 1; // default cost } } } setCost(cost) { this.cost = cost; } getPrev() { return this.prev; } setPrev(p) { this.prev = p; } getObj() { return this.obj; } setObj(obj) { this.obj = obj; } } exports.Edge = Edge; //# sourceMappingURL=Edge.js.map