@crstrskp/graph
Version:
High-performance TypeScript graph algorithms library optimized for trading bots and arbitrage detection
35 lines • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Vertex = void 0;
const GraphImpl_1 = require("./GraphImpl");
class Vertex {
setLabel(s) { this.label = s; }
getLabel() { return this.label; }
constructor(payload) {
this.id = GraphImpl_1.GraphImpl.generateId();
this.attributes = {};
if (typeof payload === 'string') {
this.label = payload;
}
else {
this.setAttribute("payload", payload);
this.label = "Vertex " + this.id;
}
this.visited = false;
this.cost = 0;
}
updateCost() {
// Future implementation for dynamic cost updates
}
setCost(cost) {
this.cost = cost;
}
getCost() { return this.cost; }
getPrev() { return this.prev; }
setPrev(e) { this.prev = e; }
getId() { return this.id; }
setAttribute(key, value) { this.attributes[key] = value; }
getAttribute(key) { return this.attributes[key]; }
}
exports.Vertex = Vertex;
//# sourceMappingURL=Vertex.js.map