commit
84bf82ad5e
|
@ -121,6 +121,12 @@ Graph.prototype.removeNode = function(node) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.detachNode(node);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// removes edges associated with a given node
|
||||||
|
Graph.prototype.detachNode = function(node) {
|
||||||
var tmpEdges = this.edges.slice();
|
var tmpEdges = this.edges.slice();
|
||||||
tmpEdges.forEach(function(e) {
|
tmpEdges.forEach(function(e) {
|
||||||
if (e.source.id === node.id || e.target.id === node.id) {
|
if (e.source.id === node.id || e.target.id === node.id) {
|
||||||
|
@ -131,7 +137,6 @@ Graph.prototype.removeNode = function(node) {
|
||||||
this.notify();
|
this.notify();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// remove a node and it's associated edges from the graph
|
// remove a node and it's associated edges from the graph
|
||||||
Graph.prototype.removeEdge = function(edge) {
|
Graph.prototype.removeEdge = function(edge) {
|
||||||
for (var i = this.edges.length - 1; i >= 0; i--) {
|
for (var i = this.edges.length - 1; i >= 0; i--) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user