{"id":13578731,"url":"https://github.com/deehzee/unionfind","last_synced_at":"2026-01-18T13:45:17.659Z","repository":{"id":47177629,"uuid":"93600617","full_name":"deehzee/unionfind","owner":"deehzee","description":"A union-find disjoint sets data structure implemented in Python with the \"Weighted Quick Union with Path Compression\" algorithm.","archived":false,"fork":false,"pushed_at":"2021-10-07T18:54:25.000Z","size":8,"stargazers_count":65,"open_issues_count":4,"forks_count":20,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-05T16:48:23.656Z","etag":null,"topics":["algorithms-datastructures","union-by-rank-and-path-compression","union-find"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deehzee.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-07T06:30:41.000Z","updated_at":"2024-07-26T04:42:44.000Z","dependencies_parsed_at":"2022-07-20T15:32:16.278Z","dependency_job_id":null,"html_url":"https://github.com/deehzee/unionfind","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deehzee%2Funionfind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deehzee%2Funionfind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deehzee%2Funionfind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deehzee%2Funionfind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deehzee","download_url":"https://codeload.github.com/deehzee/unionfind/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393095,"owners_count":20931804,"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":["algorithms-datastructures","union-by-rank-and-path-compression","union-find"],"created_at":"2024-08-01T15:01:33.288Z","updated_at":"2026-01-18T13:45:17.649Z","avatar_url":"https://github.com/deehzee.png","language":"Python","readme":"UnionFind Implementation in Python\n==================================\n\nUnion-find is a data structure that maintains disjoint set (called connected\ncomponents or components in short) membership, and makes it easier to merge\n(union) two components, and to find if two elements are connected (i.e., belong\nto the same component).\n\nThis implements the \"weighted-quick-union-with-path-compression\" union-find\nalgorithm.  Only works if elements are immutable objects.\n\nWorst case for union and find :math:`(N + M \\log^* N)`, with :math:`N` elements\nand :math:`M` union/find operations. The function :math:`\\log^*` is the number\nof times needed to take :math:`\\log` (base 2) of a number until reaching 1. In\npractice, the amortized cost of each operation is nearly linear [1]_.\n\n**Update:** This has now been packaged into an instalable pip package by\nHagai Helman Tov (@hagai-helman).\nSee the fork at https://github.com/hagai-helman/unionfind).\n\nContents\n--------\n\n* Module ``unionfind`` with the class ``UnionFind``\n\n* An example notebook ``UnionFindExamples.ipynb``\n\n* License: MIT.\n\nRequirements\n------------\n\n* ``numpy``\n\n\n.. [1] http://algs4.cs.princeton.edu/lectures/\n\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeehzee%2Funionfind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeehzee%2Funionfind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeehzee%2Funionfind/lists"}