Skip to content

Instantly share code, notes, and snippets.

@keithwhor
Created July 21, 2015 17:19
Show Gist options
  • Save keithwhor/243d3e9e419aba791ee7 to your computer and use it in GitHub Desktop.
Save keithwhor/243d3e9e419aba791ee7 to your computer and use it in GitHub Desktop.
Node class for graphs
class Node extends Unit {
constructor(entity, properties) {
super(entity, properties);
this.edges = [];
this.inputEdges = [];
this.outputEdges = [];
}
unlink() {
let edges = this.edges;
for (let i = 0, len = edges.length; i < len; i++) {
edges[i].unlink();
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment