diff --git a/lib/graph.js b/lib/graph.js index 1abb44b7..1ee9e28e 100644 --- a/lib/graph.js +++ b/lib/graph.js @@ -380,6 +380,7 @@ Graph.prototype.removeEdge = function(v, w, name) { delete this._out[v][e]; this._edgeCount--; } + return this; }; function decrementOrRemoveEntry(map, k) { diff --git a/test/graph-test.js b/test/graph-test.js index eac7dcef..593c6025 100644 --- a/test/graph-test.js +++ b/test/graph-test.js @@ -642,6 +642,11 @@ describe("Graph", function() { expect(g.predecessors("b")).to.eql(["a"]); expect(g.neighbors("b")).to.eql(["a"]); }); + + it("is chainable", function() { + g.setEdge("a", "b"); + expect(g.removeEdge("a", "b")).to.equal(g); + }); }); describe("inEdges", function() {