Files
architype/GraphLink.js

33 lines
660 B
JavaScript
Raw Normal View History

2019-07-03 03:22:42 +00:00
class GraphLink {
constructor() {
}
resolve(nodesByLabel) {
this.from = nodesByLabel.get(this.fromLabel);
this.to = nodesByLabel.get(this.toLabel);
for (let from of this.from) {
for (let to of this.to) {
from.links.push(to);
to.linksIn.push(from);
}
}
}
setPageRank() {
for (let to of this.to) {
to.incPageRank(new Set());
}
}
static process(item) {
let link = new GraphLink();
link.label = item.label;
link.fromLabel = item.from.label;
link.toLabel = item.to.label;
if (link.fromLabel == '' || link.toLabel == '') {
return null;
}
return link;
}
}