{"_id":"graphology-dag","_rev":"6-e33f87c99f378cae57717400324df738","name":"graphology-dag","dist-tags":{"latest":"0.4.1"},"versions":{"0.0.1":{"name":"graphology-dag","version":"0.0.1","description":"Directed acyclic graph functions for graphology.","main":"index.js","types":"./index.d.ts","scripts":{"prepublishOnly":"npm test","test":"mocha test.js"},"repository":{"type":"git","url":"git+https://github.com/graphology/graphology.git"},"keywords":["graph","graphology","dag","directed acyclic graph"],"author":{"name":"Guillaume Plique","url":"http://github.com/Yomguithereal"},"license":"MIT","bugs":{"url":"https://github.com/graphology/graphology/issues"},"homepage":"https://github.com/graphology/graphology#readme","peerDependencies":{"graphology-types":">=0.19.0"},"dependencies":{"graphology-utils":"^2.4.1"},"gitHead":"b9ac9ddf2e0cc21c5c4fd59f12ba981d12c2725a","_id":"graphology-dag@0.0.1","_nodeVersion":"12.22.7","_npmVersion":"8.1.0","dist":{"integrity":"sha512-gDgPD+qfVtuosg/ySf8jZbuTb3SwWr2ewyL7re7hrDcmGFUViN7lzIs2wTBF66/vUlMS3o+mFWpbkFsLaDiO1g==","shasum":"55dec8f57e0d15e4cde7f719e5ca61156167cccf","tarball":"https://registry.npmjs.org/graphology-dag/-/graphology-dag-0.0.1.tgz","fileCount":7,"unpackedSize":4984,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh3DD6CRA9TVsSAnZWagAA8XgP/RM709TyVut03flVQ2ZC\n/p5dDgdAeSnI23KinzbcA40fs+jexCK7R860b934ryi/XowmFtWKqPwn1oUz\nGB1AH2XjNPApUbJDEnrWaaZqHqgQbewqX1nfbVmp57mioA7drn0QKI7RFch2\n0oRgX3J3lpfFDUu97wrAlWld4o0lNI56TN7UuOb9Ro90lWRlxiKsC4M/8lJ/\n4wBHqxr3ATQkNhB64paPc9Fh3OfdhQj4jtUeM/ii6qzMfdahIzxFapFDUZ0Q\n1A4G81TMQPcnZ1ieRA9ITHeZ3cNO4Ty2QeGYVw2LuOPHcOztzkJMPmN3iz98\nn4RxRcwKQ9xi5Z4f4/L9N4L9+Mq+ZIocbBRXG53+ls1F6YeYOdgwBNbd6VsL\n6G+1BxQiCU0O0dWE9dQmGGQAvowjkHpCa4W/hn6IDeOOjr2KOf6umQl2Oe51\nCdjQBgzrZaow+kXNQvH2pc4oQSJlr3lFlcTDWwLF6h8T8DACxu3kUI/uw5UP\n58JBPRERdVXEYLTvkNNdGc3nwQ7xOs6IW5+OaEGCinlRG0Usn5l4hv7WWaWI\nL069/OtXsR9iyeWCrqVtR0X+YtPuJnQMK6KOzQ8s28ZgPtTRdI/wCZuFwFa0\nC2a0TdFJHBMCKX7LS8yqxSQEIVj1c/++z9lYighDgjrL+qkK2wu9bXNM9nIi\ngYRD\r\n=YKwt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCY6eeLga2B1azHyMGai/3qSJjPrnj7FsrhTkz1SO61AAIhAKZdKHpZffZgHBdzu/x8bJHJUb7nI1vidXsSQvKV5MV1"}]},"_npmUser":{"name":"yomguithereal","email":"kropotkinepiotr@gmail.com"},"directories":{},"maintainers":[{"name":"yomguithereal","email":"kropotkinepiotr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graphology-dag_0.0.1_1641820410300_0.5815180658077881"},"_hasShrinkwrap":false},"0.1.0":{"name":"graphology-dag","version":"0.1.0","description":"Directed acyclic graph functions for graphology.","main":"index.js","types":"./index.d.ts","scripts":{"prepublishOnly":"npm test","test":"mocha test.js"},"repository":{"type":"git","url":"git+https://github.com/graphology/graphology.git"},"keywords":["graph","graphology","dag","directed acyclic graph"],"author":{"name":"Guillaume Plique","url":"http://github.com/Yomguithereal"},"license":"MIT","bugs":{"url":"https://github.com/graphology/graphology/issues"},"homepage":"https://github.com/graphology/graphology#readme","peerDependencies":{"graphology-types":">=0.19.0"},"dependencies":{"graphology-utils":"^2.4.1"},"gitHead":"6cb1536af62cd7f12607d9b6f3a0c2f57a2727fb","_id":"graphology-dag@0.1.0","_nodeVersion":"12.22.7","_npmVersion":"8.1.0","dist":{"integrity":"sha512-7Q1pZ7HwnuwpBxtsSQTenqob3RpO60cTtnZLEL342PN7HLBS4thVFIGdHj5DAENcmm1OOuzCgghcxzVNJ2lAbw==","shasum":"58a695c054d5702439445071b3f31d500ad6d568","tarball":"https://registry.npmjs.org/graphology-dag/-/graphology-dag-0.1.0.tgz","fileCount":9,"unpackedSize":7695,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh3HuTCRA9TVsSAnZWagAAaTkP/j3qct4REecgFX3nRDYX\nGW7/gGRtOeh7rd04+qsTEjZUlImrVochDOHNNvr4d8C3diHtxQQlDILocg6S\nyUpXU7UENibIoQXieMUU8m+GL6644vkWtDWO8pujYFXKDt7isyUmXVBnwB9x\ny+n3z4pr2ssZG3r0E3P6S50nbC0BoE7StNp9nIP1v/n/XolmRyKKbBlE5EjI\nvR8roQD/dLKe5iVOtOuOrWHDBUM9TP316gOsbVonTyLjBjov1J6nZ5DeeEFO\nMRqfw7tw66AzPSaIbNu3BhFFlgzLKkv94O+vptA237ztEEHG36iv0fXVolVW\nQKv5fSgwVY2JWQhvImZrHKUKjy0bQDPlH5XRzEbp0Bv1LFKie2Z9i+r4Sd5I\ntsbn5+ne5Hpxx4ol9WF5VE0Gyp8Wt4TvchYFhe0Jdj5N9CrJlrAfD3hxyBmV\nAsr75s2DxYSt2SUyBISJCCcTDJnb60ZgEeCVmA1kN4wxVR3JquFh3tL3FT8M\n6QNbO2OEh7F70uScORBdSXq6vFaYaEuGVnubx8ikGmg8ehBkvL9m063ifeWq\nkdboV7hNNWfdfxFX5qTulmH3Cqqjp3HGryMiaW4bONmwCwZezg3t11mSH3IK\nLtJPMbdzxYhW6eXt4vWLYf12u3l9KN0tmFvp9emEL6JJs3VBgNNvVANkY3gE\nHogn\r\n=aw/p\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFgsiTBZ+ZqbTziAimgf+BwVQ35Dz/WvEHv1OX4ajmXNAiEAt9EirXnjMrY6fUtkajSXwfareGyz33at5X6BemXPRGg="}]},"_npmUser":{"name":"yomguithereal","email":"kropotkinepiotr@gmail.com"},"directories":{},"maintainers":[{"name":"yomguithereal","email":"kropotkinepiotr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graphology-dag_0.1.0_1641839507130_0.220778276559779"},"_hasShrinkwrap":false},"0.2.0":{"name":"graphology-dag","version":"0.2.0","description":"Directed acyclic graph functions for graphology.","main":"index.js","types":"./index.d.ts","scripts":{"prepublishOnly":"npm test","test":"mocha test.js"},"repository":{"type":"git","url":"git+https://github.com/graphology/graphology.git"},"keywords":["graph","graphology","dag","directed acyclic graph","topological sort"],"author":{"name":"Guillaume Plique","url":"http://github.com/Yomguithereal"},"license":"MIT","bugs":{"url":"https://github.com/graphology/graphology/issues"},"homepage":"https://github.com/graphology/graphology#readme","peerDependencies":{"graphology-types":">=0.19.0"},"dependencies":{"graphology-utils":"^2.4.1","mnemonist":"^0.39.0"},"gitHead":"5429a9271d999390282ab119cf2e4f74874c30cd","_id":"graphology-dag@0.2.0","_nodeVersion":"14.19.0","_npmVersion":"8.5.2","dist":{"integrity":"sha512-Bpf1P1FhzObnpX2s/L6YJUXraTcag+qnXDjMzB44b0AkZZD5/f3Un3gDna+Y2ofuERuAyflqzWAgFdRQC/+YgA==","shasum":"497165f53b9b52cdf4f8893f626e85cf09a3c0f4","tarball":"https://registry.npmjs.org/graphology-dag/-/graphology-dag-0.2.0.tgz","fileCount":11,"unpackedSize":12174,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD9T4YSUD49VzjnDuXdKx6Nx0sBNZH05QE8RI3vBPq6MAIgHxhzBSlfLlidr+MXCnaCVjCyn8UsH3c0RKGUChjKECg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiRFoSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo4GBAAlnOFbnLytwKib307voIkGfXzIadOAtjP5BVlOqswbxcjMpFK\r\nxAjxIq/AyLpcl+hnoHPohoX+d3mhFLV8Nxp7KZpbdsAsakKGRozifBHgnV0D\r\nyoCDQQbW+ArLZ3p276OOuzvBjiczwExY5XNAPEKbWxJnZvqWV4v1uF2VBAVN\r\nsY2EII1opvvwKN9N3nO24L8PfJON3DCkiz/snCbSNGojcPUSExIj2k/Z/K8f\r\nQou/zmJLgMXluI5LPNnTRJyRhu7zVIOUFs8Zs+JjU7VsvyzALXPUs6fdpB4S\r\nPdCICFeHtsZXmiVDr5OnCw7CyVFEmHfC14LxTBlZx14T54TXmH+ctpXDD8He\r\nPxIcJlj9vfY23cOch8bgOa7AB12Qs4K6kcnfDcs2/+9URgkUfN4ZlhdBkKdp\r\nF7lRUySRIqlC5HJfWuijm3PuAJIBrFhq3ahcwAYhE2OmG8IqRYWd6jzHl7e7\r\nUcIW63i9byqu2xS/5m2OwCXo/3IVcbr6s2gxaHUP/KjBy9JHsuWVehLUx7Jj\r\nQbOJUAVBxskId7hSLJvPgIcdYz7bP8PsL8yXn+NuUZy6EQHhoP99ibQjZUS5\r\ngv55WfDHd1Ygw9Ro+4Y+cU+HMPgm4/JVX48H7xzgwnQXoLMBi3mwHFNvwzZr\r\nMHH8KCpytrWyzlDg474xKtfMRJy592YlwEw=\r\n=wg07\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"yomguithereal","email":"kropotkinepiotr@gmail.com"},"directories":{},"maintainers":[{"name":"yomguithereal","email":"kropotkinepiotr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graphology-dag_0.2.0_1648646674220_0.0879486177152109"},"_hasShrinkwrap":false},"0.3.0":{"name":"graphology-dag","version":"0.3.0","description":"Directed acyclic graph functions for graphology.","main":"index.js","types":"./index.d.ts","scripts":{"prepublishOnly":"npm test","test":"mocha test.js"},"repository":{"type":"git","url":"git+https://github.com/graphology/graphology.git"},"keywords":["graph","graphology","dag","directed acyclic graph","topological sort"],"contributors":[{"name":"Guillaume Plique","url":"http://github.com/Yomguithereal"},{"name":"César Pichon","url":"http://github.com/16arpi"}],"license":"MIT","bugs":{"url":"https://github.com/graphology/graphology/issues"},"homepage":"https://github.com/graphology/graphology#readme","peerDependencies":{"graphology-types":">=0.19.0"},"dependencies":{"graphology-utils":"^2.4.1","mnemonist":"^0.39.0"},"gitHead":"dbe7608b04e23de9d1ede9cbe8689d5303cd4d9b","_id":"graphology-dag@0.3.0","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-dg4JPb+/LDEbDinZIj7ezWzlEXDRokshdpTL8oAuftE9Uy0uTKGOKSmYULY8p3j/vw0HB31Wog9T/kpqprUQpg==","shasum":"e200640cbff89dc40a3525c1a8ad2254c1d2bfed","tarball":"https://registry.npmjs.org/graphology-dag/-/graphology-dag-0.3.0.tgz","fileCount":11,"unpackedSize":15650,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEV7zk9GOSN2F7MHZzx/AxJShOlK/bav/2FK1+m1AMcJAiBdZCFYo5z/R3siUBm00A1PQ1Owu+e33s/Kq24bJ39vvg=="}]},"_npmUser":{"name":"yomguithereal","email":"kropotkinepiotr@gmail.com"},"directories":{},"maintainers":[{"name":"yomguithereal","email":"kropotkinepiotr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graphology-dag_0.3.0_1687892045376_0.0657032724985076"},"_hasShrinkwrap":false},"0.4.0":{"name":"graphology-dag","version":"0.4.0","description":"Directed acyclic graph functions for graphology.","main":"index.js","types":"./index.d.ts","scripts":{"prepublishOnly":"npm test","test":"mocha test.js"},"repository":{"type":"git","url":"git+https://github.com/graphology/graphology.git"},"keywords":["graph","graphology","dag","directed acyclic graph","topological sort"],"contributors":[{"name":"Guillaume Plique","url":"http://github.com/Yomguithereal"},{"name":"César Pichon","url":"http://github.com/16arpi"}],"license":"MIT","bugs":{"url":"https://github.com/graphology/graphology/issues"},"homepage":"https://github.com/graphology/graphology#readme","peerDependencies":{"graphology-types":">=0.19.0"},"dependencies":{"graphology-utils":"^2.4.1","mnemonist":"^0.39.0"},"gitHead":"01593343757e264fcb2cfab1c4aff9d1358ee5a6","_id":"graphology-dag@0.4.0","_nodeVersion":"16.19.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-RCwJr2npS2qjNOv+VAqAYJHuJeHwDu+tEo1v9OPmSTN8olXRocIR4HgCAonR4ji675Pe44NbuYssfWVZI+OUTQ==","shasum":"4940b5dbdeb9e4eb41b2cef1c9f3bafde056a639","tarball":"https://registry.npmjs.org/graphology-dag/-/graphology-dag-0.4.0.tgz","fileCount":11,"unpackedSize":15726,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDDSKC5JoisIdVNY+1/9CD8cZSG4SC62H5A1OLqCNF8bgIhANnMErEgbbdU6vD6EDoj4igidqhWpN7DHTpXkIkPRZVD"}]},"_npmUser":{"name":"yomguithereal","email":"kropotkinepiotr@gmail.com"},"directories":{},"maintainers":[{"name":"yomguithereal","email":"kropotkinepiotr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graphology-dag_0.4.0_1701855968247_0.9553742833381409"},"_hasShrinkwrap":false},"0.4.1":{"name":"graphology-dag","version":"0.4.1","description":"Directed acyclic graph functions for graphology.","main":"index.js","types":"./index.d.ts","scripts":{"prepublishOnly":"npm test","test":"mocha test.js"},"repository":{"type":"git","url":"git+https://github.com/graphology/graphology.git"},"keywords":["graph","graphology","dag","directed acyclic graph","topological sort"],"contributors":[{"name":"Guillaume Plique","url":"http://github.com/Yomguithereal"},{"name":"César Pichon","url":"http://github.com/16arpi"}],"license":"MIT","bugs":{"url":"https://github.com/graphology/graphology/issues"},"homepage":"https://github.com/graphology/graphology#readme","peerDependencies":{"graphology-types":">=0.19.0"},"dependencies":{"graphology-utils":"^2.4.1","mnemonist":"^0.39.0"},"gitHead":"8fbe0970710f765360f10fdeaf0ff9abc8e5410c","_id":"graphology-dag@0.4.1","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-3ch9oOAnHZDoT043vyg7ukmSkKJ505nFzaHaYOn0IF2PgGo5VtIavyVK4UpbIa4tli3hhGm1ZTdBsubTmaxu/w==","shasum":"51a7678b71ab9098cdcd3c9510fe722e77fdec44","tarball":"https://registry.npmjs.org/graphology-dag/-/graphology-dag-0.4.1.tgz","fileCount":11,"unpackedSize":15733,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCZ2DEK3wCA1azEAlh6z9Ua6O+9rAizs4p708EJTLfYDAIhAMQ0v7xrWqG4DUDyXcwYjqpzX4UojdSBMPhmvvGHFWe5"}]},"_npmUser":{"name":"yomguithereal","email":"kropotkinepiotr@gmail.com"},"directories":{},"maintainers":[{"name":"yomguithereal","email":"kropotkinepiotr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graphology-dag_0.4.1_1702110545415_0.06816912484369086"},"_hasShrinkwrap":false}},"time":{"created":"2022-01-10T13:13:30.300Z","0.0.1":"2022-01-10T13:13:30.455Z","modified":"2023-12-09T08:29:05.853Z","0.1.0":"2022-01-10T18:31:47.334Z","0.2.0":"2022-03-30T13:24:34.381Z","0.3.0":"2023-06-27T18:54:05.604Z","0.4.0":"2023-12-06T09:46:08.480Z","0.4.1":"2023-12-09T08:29:05.655Z"},"maintainers":[{"name":"yomguithereal","email":"kropotkinepiotr@gmail.com"}],"description":"Directed acyclic graph functions for graphology.","homepage":"https://github.com/graphology/graphology#readme","keywords":["graph","graphology","dag","directed acyclic graph","topological sort"],"repository":{"type":"git","url":"git+https://github.com/graphology/graphology.git"},"bugs":{"url":"https://github.com/graphology/graphology/issues"},"license":"MIT","readme":"# Graphology DAG\n\nFunctions related to Directed Acyclic Graphs (DAGs) and to be used with [`graphology`](https://graphology.github.io).\n\n## Installation\n\n```\nnpm install graphology-dag\n```\n\n## Usage\n\n- [hasCycle](#hascycle)\n- [willCreateCycle](#willcreatecycle)\n- [topologicalSort](#topologicalsort)\n- [topologicalGenerations](#topologicalgenerations)\n- [forEachNodeInTopologicalOrder](#foreachnodeintopologicalorder)\n- [forEachTopologicalGeneration](#foreachtopologicalgeneration)\n\n### hasCycle\n\nFunction returning whether the given directed graph contains at least one cycle.\n\nNote that this function will also work with a disconnected graph.\n\n```js\nimport {hasCycle} from 'graphology-dag';\n// Alternatively, to load only the relevant code:\nimport hasCycle from 'graphology-dag/has-cycle';\n\nconst graph = new DirectedGraph();\ngraph.mergeEdge(0, 1);\ngraph.mergeEdge(1, 2);\ngraph.mergeEdge(2, 3);\n\nhasCycle(graph);\n>>> false\n\ngraph.mergeEdge(3, 0);\n\nhasCycle(graph);\n>>> true\n```\n\n### willCreateCycle\n\nFunction returning whether adding the given directed edge to a DAG will create an undesired cycle.\n\nNote that this function expects a valid DAG and even if passing a cyclic graph could work it could also very well lead to undefined behavior ranging from an infinite loop to overkill memory usage.\n\nNote finally that this function will also work with DAG forests (sets of disconnected DAGs living in the same graph instance).\n\n```js\nimport {willCreateCycle} from 'graphology-dag';\n// Alternatively, to load only the relevant code:\nimport willCreateCycle from 'graphology-dag/will-create-cycle';\n\nconst graph = new DirectedGraph();\ngraph.mergeEdge(0, 1);\ngraph.mergeEdge(1, 2);\ngraph.mergeEdge(2, 3);\n\nwillCreateCycle(graph, 3, 0);\n>>> true\nwillCreateCycle(graph, 0, 2);\n>>> false\n```\n\n### topologicalSort\n\nFunction returning an array of nodes representing a possible topological ordering of the given DAG.\n\nNote that this function will throw if given graph has any cycle, is able to work on mixed graphs containing only directed edges and can work on disconnected graphs (a DAG forest).\n\n```js\nimport {topologicalSort} from 'graphology-dag';\n// Alternatively, to load only the relevant code:\nimport {topologicalSort} from 'graphology-dag/topological-sort';\n\nconst graph = new DirectedGraph();\ngraph.mergeEdge(0, 1);\ngraph.mergeEdge(1, 2);\ngraph.mergeEdge(2, 3);\n\ntopologicalSort(graph);\n>>> ['0', '1', '2', '3']\n```\n\n### topologicalGenerations\n\nFunction returning an array of array of nodes representing the successive generations of the topological ordering of the given DAG.\n\nNote that this function will throw if given graph has any cycle, is able to work on mixed graphs containing only directed edges and can work on disconnected graphs (a DAG forest).\n\n```js\nimport {topologicalGenerations} from 'graphology-dag';\n// Alternatively, to load only the relevant code:\nimport {topologicalGenerations} from 'graphology-dag/topological-sort';\n\nconst graph = new DirectedGraph();\ngraph.mergeEdge(0, 1);\ngraph.mergeEdge(1, 2);\ngraph.mergeEdge(0, 3);\n\ntopologicalGenerations(graph);\n>>> [[ '0' ], ['1', '3'], ['2']]\n```\n\n### forEachNodeInTopologicalOrder\n\nFunction iterating over the given DAG's nodes in topological order using a callback function.\n\nNote that this function will throw if given graph has any cycle, is able to work on mixed graphs containing only directed edges and can work on disconnected graphs (a DAG forest).\n\n```js\nimport {forEachNodeInTopologicalOrder} from 'graphology-dag';\n// Alternatively, to load only the relevant code:\nimport {forEachNodeInTopologicalOrder} from 'graphology-dag/topological-sort';\n\nconst graph = new DirectedGraph();\ngraph.mergeEdge(0, 1);\ngraph.mergeEdge(1, 2);\ngraph.mergeEdge(2, 3);\n\nforEachNodeInTopologicalOrder(graph, (node, attr, generationIndex) => {\n  // Note that generationIndex will be monotonically increasing from 0 to n.\n  console.log(node, attr, generationIndex);\n});\n```\n\n### forEachTopologicalGeneration\n\nFunction iterating over the given DAG's generations, represented by an array of node keys, using a callback function.\n\nNote that this function will throw if given graph has any cycle, is able to work on mixed graphs containing only directed edges and can work on disconnected graphs (a DAG forest).\n\n```js\nimport {forEachTopologicalGeneration} from 'graphology-dag';\n// Alternatively, to load only the relevant code:\nimport {forEachTopologicalGeneration} from 'graphology-dag/topological-sort';\n\nconst graph = new DirectedGraph();\ngraph.mergeEdge(0, 1);\ngraph.mergeEdge(1, 2);\ngraph.mergeEdge(2, 3);\n\nforEachTopologicalGeneration(graph, generation => {\n  console.log(generation);\n});\n```\n","readmeFilename":"README.md","contributors":[{"name":"Guillaume Plique","url":"http://github.com/Yomguithereal"},{"name":"César Pichon","url":"http://github.com/16arpi"}]}