{"name":"dependency-graph","description":"Simple dependency graph.","version":"0.7.2","author":{"name":"Jim Riecken","email":"jriecken@gmail.com"},"keywords":["dependency","graph"],"license":{"type":"MIT","url":"http://github.com/jriecken/dependency-graph/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/jriecken/dependency-graph.git"},"bugs":{"url":"http://github.com/jriecken/dependency-graph/issues"},"main":"./lib/dep_graph.js","scripts":{"test":"jasmine-node specs"},"dependencies":{},"optionalDependencies":{},"devDependencies":{"jasmine-node":"2.0.1"},"engines":{"node":">= 0.6.0"},"types":"./lib/index.d.ts","gitHead":"bcaed9999c93d5152fd2ad7c550b0acc9384c35d","homepage":"https://github.com/jriecken/dependency-graph#readme","_id":"dependency-graph@0.7.2","_npmVersion":"6.4.1","_nodeVersion":"8.10.0","_npmUser":{"name":"jriecken","email":"jriecken@gmail.com"},"dist":{"integrity":"sha512-KqtH4/EZdtdfWX0p6MGP9jljvxSY6msy/pRUD4jgNwVpv3v1QmNLlsB3LDSSUg79BRVSn7jI1QPRtArGABovAQ==","shasum":"91db9de6eb72699209d88aea4c1fd5221cac1c49","tarball":"http://registry-npm.ywwl.com/dependency-graph/download/dependency-graph-0.7.2.tgz","fileCount":7,"unpackedSize":28372,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbiLDKCRA9TVsSAnZWagAAU68QAJrn8WSeLBvR7o/ifXDU\nq2vAs/Xx8tkDk+jQuPTM4zdzJ1uRY/3+Hf05SV3h+tDtwN53h31WWDKOYE7+\n4PhW0oLR42eFWDgVlhH08rGei46eYGtvlTtSFrtkhITXur4ilQEUXvveYk2F\nwEkzYScvQz0+PmRbfn4Hby9uyUa+tbGUy3QB3DGx2fmguQSBdlXQ0dxJ0Zjn\nycp/WxI+mvM0kSUYjUKeR9XW6yNZqp2Ft+Ag9EpYz9lL6gB3ffDu1UB9j/UD\nnJ5MbMPDNalBQxDCMPPZgzKV/2Pdev/tsgZgeilJsFHY3pmYoHRFzaFylfla\n9jgV/xiF/w4T7FdXd0XGMYexAisR29pzsr6jikNpqRH3WM/TD812vAhlePP8\n2IVBwyzrxhycO5kfESKU1ptoQsFXhRsHtSHV7DQpD+kJjrlO20eXSFfxV98P\nuUqv4vFemw+ajauAJqFp0OgyWl+HU7En4rX/tgRujwH0SGMbLnEAfYYY81/o\nwchgV0GFEbEmn7DFNmp7LBhonAdwU++LGnt727Gv4rPlrDtyUMFjaRQ5br1n\nB1+nM7SwHuF7mCN4eYumQyg3Z6pUjaMgC6hcX8l/Rs3FE97WUjDAjiUdFYfV\nb21N0SlFC5jUE/Ujz+EheI7HnkD4Smoeqy3QEwEX1cCOu8K7xG3c2f2FjeGL\nzM/b\r\n=+H2k\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBxgMcHcovKNevKKXjGVkTOvaZz16sNkPPvfIuu3D9odAiAJFY/Uj3ZbYqUXpXuZqTMQqGkVPpbsHowkt8C+9A6Nlw=="}],"size":6445,"noattachment":false,"key":"/dependency-graph/-/dependency-graph-0.7.2.tgz"},"maintainers":[{"name":"jriecken","email":"jriecken@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dependency-graph_0.7.2_1535684809127_0.49738070914896615"},"_hasShrinkwrap":false,"readme":"# Dependency Graph\n\nSimple dependency graph\n\n## Overview\n\nThis is a simple dependency graph useful for determining the order to do a list of things that depend on certain items being done before they are.\n\nTo use, `npm install dependency-graph` and then `require('dependency-graph').DepGraph`\n\n## API\n\n### DepGraph\n\nNodes in the graph are just simple strings with optional data associated with them.\n\n - `addNode(name, data)` - add a node in the graph with optional data. If `data` is not given, `name` will be used as data\n - `removeNode(name)` - remove a node from the graph\n - `hasNode(name)` - check if a node exists in the graph\n - `size()` - return the number of nodes in the graph\n - `getNodeData(name)` - get the data associated with a node (will throw an `Error` if the node does not exist)\n - `setNodeData(name, data)` - set the data for an existing node (will throw an `Error` if the node does not exist)\n - `addDependency(from, to)` - add a dependency between two nodes (will throw an `Error` if one of the nodes does not exist)\n - `removeDependency(from, to)` - remove a dependency between two nodes\n - `clone()` - return a clone of the graph. Any data attached to the nodes will only be *shallow-copied*\n - `dependenciesOf(name, leavesOnly)` - get an array containing the nodes that the specified node depends on (transitively). If `leavesOnly` is true, only nodes that do not depend on any other nodes will be returned in the array.\n - `dependantsOf(name, leavesOnly)` (aliased as `dependentsOf`) - get an array containing the nodes that depend on the specified node (transitively). If `leavesOnly` is true, only nodes that do not have any dependants will be returned in the array.\n - `directDependenciesOf(name)` - get an array containing the direct dependencies of the specified node\n - `directDependantsOf(name)` (aliased as `directDependentsOf`) - get an array containing the nodes that directly depend on the specified node\n - `overallOrder(leavesOnly)` - construct the overall processing order for the dependency graph. If `leavesOnly` is true, only nodes that do not depend on any other nodes will be returned.\n - `entryNodes()` - array of nodes that have no dependants (i.e. nothing depends on them).\n\nDependency Cycles are detected when running `dependenciesOf`, `dependantsOf`, and `overallOrder` and if one is found, a `DepGraphCycleError` will be thrown that includes what the cycle was in the message as well as the `cyclePath` property: e.g. `Dependency Cycle Found: a -> b -> c -> a`. If you wish to silence this error, pass `circular: true` when instantiating `DepGraph` (more below).\n\n## Examples\n\n    var DepGraph = require('dependency-graph').DepGraph;\n\n    var graph = new DepGraph();\n    graph.addNode('a');\n    graph.addNode('b');\n    graph.addNode('c');\n\n    graph.size() // 3\n\n    graph.addDependency('a', 'b');\n    graph.addDependency('b', 'c');\n\n    graph.dependenciesOf('a'); // ['c', 'b']\n    graph.dependenciesOf('b'); // ['c']\n    graph.dependantsOf('c'); // ['a', 'b']\n\n    graph.overallOrder(); // ['c', 'b', 'a']\n    graph.overallOrder(true); // ['c']\n    graph.entryNodes(); // ['a']\n\n    graph.addNode('d', 'data');\n\n    graph.getNodeData('d'); // 'data'\n\n    graph.setNodeData('d', 'newData');\n\n    graph.getNodeData('d'); // 'newData'\n\n    var circularGraph = new DepGraph({ circular: true });\n\n    circularGraph.addNode('a');\n    circularGraph.addNode('b');\n    circularGraph.addNode('c');\n    circularGraph.addNode('d');\n\n    circularGraph.addDependency('a', 'b');\n    circularGraph.addDependency('b', 'c'); // b depends on c\n    circularGraph.addDependency('c', 'a'); // c depends on a, which depends on b\n    circularGraph.addDependency('d', 'a');\n\n    circularGraph.dependenciesOf('b'); // ['a', 'c']\n    circularGraph.overallOrder(); // ['c', 'b', 'a', 'd']\n","publish_time":1535684809549,"_cnpm_publish_time":1535684809549,"dist-tags":{"latest":"1.0.0"}}