jriecken / dependency-graph

A simple dependency graph for Node.js
http://jriecken.github.io/dependency-graph/
MIT License
333 stars 49 forks source link

Fixed removeNode leaving references in outgoingEdges and reference to… #2

Closed juhoha closed 9 years ago

juhoha commented 9 years ago

… non-existent var edges

For example:

var deps = new (require('dependency-graph').DepGraph)(); deps.addNode('a'); deps.addNode('b'); deps.addNode('c'); deps.addDependency('a', 'b'); deps.addDependency('b', 'c'); console.log(deps); deps.removeNode('c'); console.log(deps);

{ nodes: { a: 'a', b: 'b', c: 'c' }, outgoingEdges: { a: [ 'b' ], b: [ 'c' ], c: [] }, incomingEdges: { a: [], b: [ 'a' ], c: [ 'b' ] } } { nodes: { a: 'a', b: 'b' }, outgoingEdges: { a: [ 'b' ], b: [ 'c' ] }, incomingEdges: { a: [], b: [ 'a' ] } }

jriecken commented 9 years ago

Thanks!

jriecken commented 9 years ago

I've released version 0.2.1.