{
"name": "gaia-tsort",
"version": "0.1.0",
"description": "Topological sort utility for directed acyclic graphs.",
"author": {
"name": "Jake Luer",
"email": "jake@qualiancy.com",
"url": "http://qualiancy.com"
},
"license": "MIT",
"keywords": [],
"repository": {
"type": "git",
"url": "git@github.com:qualiancy/gaia-tsort.git"
},
"engines": {
"node": "*"
},
"main": "./index",
"scripts": {
"test": "make test"
},
"dependencies": {},
"devDependencies": {
"chai": "*",
"component": "*",
"mocha": "*",
"mocha-phantomjs": "*"
},
"readme": "# gaia-tsort [![Build Status](https://secure.travis-ci.org/qualiancy/gaia-tsort.png?branch=master)](https://travis-ci.org/qualiancy/gaia-tsort)\n\n> Topological sort utility for directed acyclic graphs.\n\n## Installation\n\n### Node.js\n\n`gaia-tsort` is available on [npm](http://npmjs.org).\n\n $ npm install gaia-tsort\n\n### Component\n\n`gaia-tsort` is available as a [component](https://github.com/component/component).\n\n $ component install qualiancy/gaia-tsort\n\n## Usage\n\n### tsort (edges)\n\n* **@param** _{Array}_ edges \n* **@return** _{Object}_ \n\nTopological sorting is a methodology used to organize a\ndirected-acyclic-graph (DAG). A DAG is a graph of nodes in\nwhich there are no cyclic references, and therefor has\na specific starting and ending point.\n\nA set of edges is defined as an array, with each element being\nan array of x, y pairs, where `x` is a parent of `y`.\n\n```js\nvar edges = [\n [ 'a', 'b' ]\n , [ 'a', 'c' ]\n , [ 'd', 'e' ]\n , [ 'b', 'd' ]\n];\n```\n\nWith the above edges, we expect `a` to be the top-most parent.\n`b` and `c` are it's children; `d` is a child of `b`; `e` is a\nchild of `d`.\n\nThe following demonstrates the output of this tool.\n\n```js\nvar tsort = require('gaia-tsort')\n , sorted = tsort(edges);\n\n// console.log(sorted);\n{\n path: [ 'a', 'c', 'b', 'd', 'e' ]\n , graph: [\n { id: 'a', children: [ 'b', 'c' ], parents: [] }\n , { id: 'c', children: [], parents: [ 'a' ] }\n , { id: 'b', children: [ 'd' ], parents: [ 'a' ] }\n , { id: 'd', children: [ 'e' ], parents: [ 'b' ] }\n , { id: 'e', children: [], parents: [ 'd' ] }\n ]\n}\n```\n\nShould there a cyclical reference, the result will resemble the following.\n\n```js\n{\n error: new Error('child-name can not come before parent-name')\n}\n```\n\n\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2012 Jake Luer <jake@qualiancy.com> (http://qualiancy.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n",
"_id": "gaia-tsort@0.1.0",
"dist": {
"shasum": "c9ed461ff096e12b8662dd06c41efa6101d7e840",
"tarball": "http://registry.npmjs.org/gaia-tsort/-/gaia-tsort-0.1.0.tgz"
},
"_npmVersion": "1.1.63",
"_npmUser": {
"name": "jakeluer",
"email": "jake@alogicalparadox.com"
},
"maintainers": [
{
"name": "jakeluer",
"email": "jake@alogicalparadox.com"
}
],
"directories": {},
"_shasum": "c9ed461ff096e12b8662dd06c41efa6101d7e840",
"_from": "gaia-tsort@^0.1.0",
"_resolved": "https://registry.npmjs.org/gaia-tsort/-/gaia-tsort-0.1.0.tgz",
"bugs": {
"url": "https://github.com/qualiancy/gaia-tsort/issues"
},
"homepage": "https://github.com/qualiancy/gaia-tsort"
}