{"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","tarball":"http://registry-npm.ywwl.com/graph-simple-sequencer/download/graph-simple-sequencer-1.0.1.tgz","integrity":"sha512-vVmPEB4wr19Q/0fQBa+0oiPzQLdOUz0z/FWpAyOQWdtdprdh0HQafdHxSBfYzu24AjO1tKOn9MCFm2kWiomc2A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFPPqPacImOzjX4ntsH4hq1YOSnrWiW46qooA7YoeLNlAiEAhUNKrg30xE6HZ1dcOXUE42dywVhO+1usMAug7XkCqII="}],"size":2649,"noattachment":false,"key":"/graph-simple-sequencer/-/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":{},"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","publish_time":1513918616132,"_cnpm_publish_time":1513918616132,"dist-tags":{"latest":"1.0.3"}}