maia-markov
Version:
Markov analysis and generation functions supporting various applications by Music Artificial Intelligence Algorithms, Inc.
30 lines (28 loc) • 763 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Vertex;
// Constructor for Vertex object
function Vertex(_name) {
// Workaround for JS context peculiarities.
// var self = this;
this.name = _name;
// Neighbors (nbs) will be an array of Edges.
this.nbs = [];
// Useful for calculating shortest path
this.dist = Infinity;
this.visited = false;
this.prev = null; // Will be of type Vertex.
// Possible to return something.
// return sth;
}
// exports.Vertex = Vertex
// Methods for Vertex object
Vertex.prototype = {
constructor: Vertex,
// Currently unused, e.g., because priorities are passed to PQ explicitly.
compare_to: function compare_to(v) {
return this.dist - v.dist;
}
};