spectral-clustering-js
Version:
Spectral clustering package for TypeScript
42 lines (41 loc) • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var Point_1 = require("./Point");
var Node = /** @class */ (function () {
function Node(coords) {
this.connectedNodes = new Map();
this.color = "blue";
this.cluster = 0;
this.coords = new Point_1.Point(coords);
this.id = Math.floor(Math.random() * Date.now()).toString();
}
Node.prototype.getId = function () {
return this.id;
};
Node.prototype.getPoint = function () {
return this.coords;
};
Node.prototype.setColor = function (color) {
this.color = color;
};
Node.prototype.getColor = function () {
return this.color;
};
Node.prototype.setCluster = function (cluster) {
this.cluster = cluster;
};
Node.prototype.getCluster = function () {
return this.cluster;
};
Node.prototype.addConnectedNode = function (node) {
this.connectedNodes.set(node.getId(), node);
};
Node.prototype.isConnectedTo = function (node) {
return this.connectedNodes.has(node.getId());
};
Node.prototype.getConnectedNodes = function () {
return this.connectedNodes;
};
return Node;
}());
exports.Node = Node;