{"_id":"graph-simple-sequencer","_rev":"269685","name":"graph-simple-sequencer","description":"Sort items in a graph using a topological sort into chunks","dist-tags":{"latest":"1.0.3"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"time":{"modified":"2021-06-03T17:18:04.000Z","created":"2017-12-22T04:48:21.915Z","1.0.3":"2017-12-22T05:10:16.182Z","1.0.2":"2017-12-22T05:01:53.417Z","1.0.1":"2017-12-22T04:56:56.132Z","1.0.0":"2017-12-22T04:48:21.915Z"},"users":{},"author":{"name":"James Kyle","email":"me@thejameskyle.com"},"repository":{"type":"git","url":"git+https://github.com/thejameskyle/graph-simple-sequencer.git"},"versions":{"1.0.3":{"name":"graph-simple-sequencer","version":"1.0.3","description":"Sort items in a graph using a topological sort into chunks","main":"index.js","author":{"name":"James Kyle","email":"me@thejameskyle.com"},"repository":{"type":"git","url":"git+https://github.com/thejameskyle/graph-simple-sequencer.git"},"license":"MIT","keywords":["graph","adjacency","list","tasks","priority","priorities","sort","dependencies","topological","topo","sequencer"],"files":["index.js"],"scripts":{"test":"ava test.js"},"devDependencies":{"ava":"^0.24.0","flow-bin":"^0.61.0"},"dependencies":{"array-includes":"^3.0.3"},"gitHead":"76cb4ff21cd8d74fa42d02240ea4517b8eb86725","bugs":{"url":"https://github.com/thejameskyle/graph-simple-sequencer/issues"},"homepage":"https://github.com/thejameskyle/graph-simple-sequencer#readme","_id":"graph-simple-sequencer@1.0.3","_shasum":"80e040ba3ca3b44cffb1b3db8afa6484166982fc","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.8.4","_npmUser":{"name":"thejameskyle","email":"me@thejameskyle.com"},"dist":{"shasum":"80e040ba3ca3b44cffb1b3db8afa6484166982fc","size":2697,"noattachment":false,"key":"/graph-simple-sequencer/-/graph-simple-sequencer-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/graph-simple-sequencer/download/graph-simple-sequencer-1.0.3.tgz"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graph-simple-sequencer-1.0.3.tgz_1513919416101_0.41625158465467393"},"directories":{},"publish_time":1513919416182,"_hasShrinkwrap":false,"_cnpm_publish_time":1513919416182},"1.0.2":{"name":"graph-simple-sequencer","version":"1.0.2","description":"Sort items in a graph using a topological sort into chunks","main":"index.js","author":{"name":"James Kyle","email":"me@thejameskyle.com"},"repository":{"type":"git","url":"git+https://github.com/thejameskyle/graph-simple-sequencer.git"},"license":"MIT","keywords":["graph","adjacency","list","tasks","priority","priorities","sort","dependencies","topological","topo","sequencer"],"files":["index.js"],"scripts":{"test":"ava test.js"},"devDependencies":{"ava":"^0.24.0","flow-bin":"^0.61.0"},"gitHead":"855957caf3755bd5bc9e29db8b39d027d48d9b9d","bugs":{"url":"https://github.com/thejameskyle/graph-simple-sequencer/issues"},"homepage":"https://github.com/thejameskyle/graph-simple-sequencer#readme","_id":"graph-simple-sequencer@1.0.2","_shasum":"ebbb4093a1cce7872af05bce7f2df262a4226853","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"thejameskyle","email":"me@thejameskyle.com"},"dist":{"shasum":"ebbb4093a1cce7872af05bce7f2df262a4226853","size":2664,"noattachment":false,"key":"/graph-simple-sequencer/-/graph-simple-sequencer-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/graph-simple-sequencer/download/graph-simple-sequencer-1.0.2.tgz"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graph-simple-sequencer-1.0.2.tgz_1513918913340_0.9762259828858078"},"directories":{},"publish_time":1513918913417,"_hasShrinkwrap":false,"_cnpm_publish_time":1513918913417},"1.0.1":{"name":"graph-simple-sequencer","version":"1.0.1","description":"Sort items in a graph using a topological sort into chunks","main":"index.js","author":{"name":"James Kyle","email":"me@thejameskyle.com"},"repository":{"type":"git","url":"git+https://github.com/thejameskyle/graph-simple-sequencer.git"},"license":"MIT","keywords":["graph","adjacency","list","tasks","priority","priorities","sort","dependencies","topological","topo","sequencer"],"files":["index.js"],"scripts":{"test":"ava test.js"},"devDependencies":{"ava":"^0.24.0","flow-bin":"^0.61.0"},"gitHead":"02c29b376b7dff71f4fabff55c956311971b0836","bugs":{"url":"https://github.com/thejameskyle/graph-simple-sequencer/issues"},"homepage":"https://github.com/thejameskyle/graph-simple-sequencer#readme","_id":"graph-simple-sequencer@1.0.1","_shasum":"7aaf80e2e7e33cb5f65fb3c6cd1457546c9d6133","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"thejameskyle","email":"me@thejameskyle.com"},"dist":{"shasum":"7aaf80e2e7e33cb5f65fb3c6cd1457546c9d6133","size":2649,"noattachment":false,"key":"/graph-simple-sequencer/-/graph-simple-sequencer-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/graph-simple-sequencer/download/graph-simple-sequencer-1.0.1.tgz"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graph-simple-sequencer-1.0.1.tgz_1513918615946_0.37354189227335155"},"directories":{},"publish_time":1513918616132,"_hasShrinkwrap":false,"_cnpm_publish_time":1513918616132},"1.0.0":{"name":"graph-simple-sequencer","version":"1.0.0","description":"Sort items in a graph using a topological sort into chunks","main":"index.js","author":{"name":"James Kyle","email":"me@thejameskyle.com"},"repository":{"type":"git","url":"git+https://github.com/thejameskyle/graph-simple-sequencer.git"},"license":"MIT","keywords":["graph","adjacency","list","tasks","priority","priorities","sort","dependencies","topological","topo","sequencer"],"files":["index.js"],"scripts":{"test":"ava test.js"},"devDependencies":{"ava":"^0.24.0","flow-bin":"^0.61.0"},"gitHead":"d29ef70f762ffba2464118e0f9703d79a4ba1438","bugs":{"url":"https://github.com/thejameskyle/graph-simple-sequencer/issues"},"homepage":"https://github.com/thejameskyle/graph-simple-sequencer#readme","_id":"graph-simple-sequencer@1.0.0","_shasum":"fb66493eca35fdb9dedecaffc4b89141cc89b56b","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"thejameskyle","email":"me@thejameskyle.com"},"dist":{"shasum":"fb66493eca35fdb9dedecaffc4b89141cc89b56b","size":2616,"noattachment":false,"key":"/graph-simple-sequencer/-/graph-simple-sequencer-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/graph-simple-sequencer/download/graph-simple-sequencer-1.0.0.tgz"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graph-simple-sequencer-1.0.0.tgz_1513918101780_0.4825414849910885"},"directories":{},"publish_time":1513918101915,"_hasShrinkwrap":false,"_cnpm_publish_time":1513918101915}},"readme":"# graph-simple-sequencer\n\n> Sort items in a graph using a topological sort into chunks\n\n## Install\n\n```sh\nyarn add graph-simple-sequencer\n```\n\n## Usage\n\n```js\nimport graphSimpleSequencer from 'graph-simple-sequencer';\n\nlet graph = new Map([\n  [\"task-a\", [\"task-d\"]], // task-a depends on task-d\n  [\"task-b\", [\"task-d\", \"task-a\"]],\n  [\"task-c\", [\"task-d\"]],\n  [\"task-d\", [\"task-a\"]],\n]);\n\nlet { safe, chunks } = graphSimpleSequencer(graph);\n// { safe: false,\n//   chunks: [['task-d'], ['task-a', 'task-b', 'task-c']] }\n\nfor (let chunk of chunks) {\n  // Running tasks in parallel\n  await Promise.all(chunk.map(task => exec(task)));\n}\n```\n\n## Cycles\n\nGraph cycles are resolved by creating a new chunk with the item that has:\n\n1. The fewest number of remaining dependencies (to reduce risk of missing dependencies)\n2. The highest number of remaining dependents (to increase chance of unblocking dependents)\n","_attachments":{},"homepage":"https://github.com/thejameskyle/graph-simple-sequencer#readme","bugs":{"url":"https://github.com/thejameskyle/graph-simple-sequencer/issues"},"license":"MIT"}