Skip to content

Commit

Permalink
Small speedup to sources / sinks
Browse files Browse the repository at this point in the history
  • Loading branch information
cpettitt committed Sep 24, 2014
1 parent a1caaec commit 456fe49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ Graph.prototype.nodes = function() {

Graph.prototype.sources = function() {
return _.filter(this.nodes(), function(v) {
return !this.inEdges(v).length;
return _.isEmpty(this._in[v]);
}, this);
};

Graph.prototype.sinks = function() {
return _.filter(this.nodes(), function(v) {
return !this.outEdges(v).length;
return _.isEmpty(this._out[v]);
}, this);
};

Expand Down

0 comments on commit 456fe49

Please sign in to comment.