{"id":13458239,"url":"https://github.com/bwesterb/py-tarjan","last_synced_at":"2025-05-01T09:17:20.644Z","repository":{"id":1626133,"uuid":"2327402","full_name":"bwesterb/py-tarjan","owner":"bwesterb","description":"Python implementation of Tarjan's strongly connected components algorithm.","archived":false,"fork":false,"pushed_at":"2023-04-14T08:37:57.000Z","size":77,"stargazers_count":95,"open_issues_count":0,"forks_count":16,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-01T09:17:15.059Z","etag":null,"topics":["dependancy-manager","graph-algorithms","python","scc","tarjan","transitive-closure"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"boonebgorges/invite-anyone","license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bwesterb.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2011-09-05T09:48:58.000Z","updated_at":"2025-04-13T05:17:01.000Z","dependencies_parsed_at":"2023-07-05T18:32:30.550Z","dependency_job_id":null,"html_url":"https://github.com/bwesterb/py-tarjan","commit_stats":{"total_commits":38,"total_committers":3,"mean_commits":"12.666666666666666","dds":0.07894736842105265,"last_synced_commit":"e6e89524601b0f8d4b4a94423cde5c5abc5a04ec"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwesterb%2Fpy-tarjan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwesterb%2Fpy-tarjan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwesterb%2Fpy-tarjan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwesterb%2Fpy-tarjan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bwesterb","download_url":"https://codeload.github.com/bwesterb/py-tarjan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251850182,"owners_count":21653978,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dependancy-manager","graph-algorithms","python","scc","tarjan","transitive-closure"],"created_at":"2024-07-31T09:00:48.182Z","updated_at":"2025-05-01T09:17:20.587Z","avatar_url":"https://github.com/bwesterb.png","language":"Python","funding_links":[],"categories":["Awesome Algorithms"],"sub_categories":["SCC - Strongly connected component (强连通分量)"],"readme":"Python implementation of Tarjan's algorithm\n===========================================\n\nTarjan's algorithm takes as input a directed (possibly cyclic!) graph and\nreturns as output its strongly connected components in a topological order.\n\nExample\n-------\n\n.. image:: https://raw.githubusercontent.com/bwesterb/py-tarjan/master/doc/example.png\n\n.. code::\n\n   \u003e\u003e\u003e tarjan({1:[2],2:[1,5],3:[4],4:[3,5],5:[6],6:[7],7:[8],8:[6,9],9:[]})\n   [[9], [8, 7, 6], [5], [2, 1], [4, 3]]\n\nUses\n----\n\nCyclic dependencies\n~~~~~~~~~~~~~~~~~~~\n\nIn various cases, dependencies might be cyclic and a group of interdependant\nactions must be executed simultaneously.  It is not uncommon that\nthe simulataneous execution is costly.  With Tarjan's algorithm, one can\ndetermine an efficient order in which to execute the groups of interdependant\nactions.\n\nTransitive closure\n~~~~~~~~~~~~~~~~~~\n\nUsing Tarjan's algorithm, one can efficiently compute the transitive\nclosure of a graph.  (Given a graph *G*, the transitive closure of *G*\nis a graph that contains the same vertices and contains an edge from *v*\nto *w* if and only if there is a path from *v* to *w* in *G*.)\n\nThe transitive closure is implemented in `tarjan.tc`:\n\n.. code::\n\n    \u003e\u003e\u003e from tarjan.tc import tc\n    \u003e\u003e\u003e tc({1:[2],2:[1,5],3:[4],4:[3,5],5:[6],6:[7],7:[8],8:[6,9],9:[]})\n    {1: (1, 2, 5, 6, 7, 8, 9),\n     2: (1, 2, 5, 6, 7, 8, 9),\n     3: (3, 4, 5, 6, 7, 8, 9),\n     4: (3, 4, 5, 6, 7, 8, 9),\n     5: (8, 9, 6, 7),\n     6: (8, 9, 6, 7),\n     7: (8, 9, 6, 7),\n     8: (8, 9, 6, 7),\n     9: ()}\n\nExpand group hierarchies\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nGiven a graph of groups, one can use the transitive closure to determine\nall indirect members of a group.  (Someone is an indirect member of a group,\nif it is a member of a group that is a member of a group that ... is a member\nof the group.)\n\nInstallation\n------------\nSimply execute\n\n.. code::\n\n    pip install tarjan\n\nor from this source distribution, run\n\n.. code::\n\n    python setup.py install\n\n.. image:: https://travis-ci.org/bwesterb/py-tarjan.png\n   :target: https://travis-ci.org/bwesterb/py-tarjan\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwesterb%2Fpy-tarjan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbwesterb%2Fpy-tarjan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwesterb%2Fpy-tarjan/lists"}