{"id":18358507,"url":"https://github.com/ccozad/cozad-union-find","last_synced_at":"2025-09-25T11:06:02.112Z","repository":{"id":62439037,"uuid":"456406171","full_name":"ccozad/cozad-union-find","owner":"ccozad","description":"A Rust implementation of the union-find disjoint set graph algorithm","archived":false,"fork":false,"pushed_at":"2023-06-17T23:56:49.000Z","size":50,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-20T03:40:05.810Z","etag":null,"topics":["disjoint-set","disjoint-sets","rust","union-find","union-find-algorithm"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/ccozad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-07T07:47:42.000Z","updated_at":"2025-04-03T20:03:46.000Z","dependencies_parsed_at":"2025-04-06T13:35:43.173Z","dependency_job_id":"dbe0faef-359d-4bb1-9d63-c3e9aec086ce","html_url":"https://github.com/ccozad/cozad-union-find","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ccozad/cozad-union-find","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccozad%2Fcozad-union-find","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccozad%2Fcozad-union-find/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccozad%2Fcozad-union-find/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccozad%2Fcozad-union-find/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ccozad","download_url":"https://codeload.github.com/ccozad/cozad-union-find/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccozad%2Fcozad-union-find/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276905424,"owners_count":25725559,"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","status":"online","status_checked_at":"2025-09-25T02:00:09.612Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["disjoint-set","disjoint-sets","rust","union-find","union-find-algorithm"],"created_at":"2024-11-05T22:18:14.465Z","updated_at":"2025-09-25T11:06:02.080Z","avatar_url":"https://github.com/ccozad.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cozad-union-find\nA Rust implementation of the union-find disjoint set graph algorithm\n\n![MIT License](https://img.shields.io/github/license/ccozad/cozad-union-find) ![Code Size](https://img.shields.io/github/languages/code-size/ccozad/cozad-union-find) ![Top Language](https://img.shields.io/github/languages/top/ccozad/cozad-union-find)\n![Crates.io](https://img.shields.io/crates/v/cozad_union_find)\n\n# Quick Start\n\n## Instalation\nAdd the following to your Cargo.toml file\n\n```\ncozad-union-find = \"1.1.0\"\n```\n\n## Using the named node interfaces\nFor relatively small networks you can simply interact with nodes by name.\n\n``` rust\nextern crate cozad_union_find;\nuse cozad_union_find::union_find::client as ufclient;\n\nfn main() {\n    let mut client = ufclient::Client::new();\n\n    client.add_node(\"A\");\n    client.add_node(\"B\");\n    client.add_node(\"C\");\n    client.add_node(\"D\");\n    client.add_node(\"E\");\n    client.add_node(\"F\");\n    client.add_node(\"G\");\n    client.add_node(\"H\");\n    client.add_node(\"I\");\n    client.add_node(\"J\");\n\n\n    client.connect_nodes(\"E\", \"D\");\n    client.connect_nodes(\"D\", \"I\");\n    client.connect_nodes(\"G\", \"F\");\n    client.connect_nodes(\"J\", \"E\");\n    client.connect_nodes(\"C\", \"B\");\n    client.connect_nodes(\"I\", \"J\");\n    client.connect_nodes(\"F\", \"A\");\n    client.connect_nodes(\"H\", \"B\");\n    client.connect_nodes(\"G\", \"B\");\n    client.connect_nodes(\"B\", \"A\");\n    client.connect_nodes(\"G\", \"H\");\n\n    println!(\"\\nDisjoint sets found: {}\", client.disjoint_set_count());\n}\n```\n\nOutput\n```\nDisjoint sets found: 2\n```\n\n## Using the bulk interfaces\n\nWhen you have a large volume of connections to process you can skip the lookups that occur with named nodes and use the bulk interfaces. The process involves giving a vector of node names and then specifying connections between nodes by index.\n\n``` rust\nextern crate cozad_union_find;\nuse cozad_union_find::union_find::client as ufclient;\nuse cozad_union_find::union_find::client::BulkConnection as ufconnection;\n\nfn main() {\n\n    let mut bulk_client = ufclient::Client::new();\n    let nodes = vec![\n        String::from(\"A\"), \n        String::from(\"B\"), \n        String::from(\"C\"),\n        String::from(\"D\"),\n        String::from(\"E\"),\n        String::from(\"F\"), \n        String::from(\"G\"), \n        String::from(\"H\"), \n        String::from(\"I\"), \n        String::from(\"J\")\n    ];\n    bulk_client.add_nodes_bulk(nodes);\n\n    let connections = vec![\n        ufconnection { a: 4, b: 3 },\n        ufconnection { a: 3, b: 8 },\n        ufconnection { a: 6, b: 5 },\n        ufconnection { a: 9, b: 4 },\n        ufconnection { a: 2, b: 1 },\n        ufconnection { a: 8, b: 9 },\n        ufconnection { a: 5, b: 0 },\n        ufconnection { a: 7, b: 2 },\n        ufconnection { a: 6, b: 1 },\n        ufconnection { a: 1, b: 0 },\n        ufconnection{ a: 6, b: 7 }\n    ];\n    bulk_client.connect_nodes_bulk(connections);\n\n    println!(\"\\nDisjoint sets found: {}\", bulk_client.disjoint_set_count());\n}\n```\n\nOutput\n```\nDisjoint sets found: 2\n```\n\n## Run as a CLI\n\n```\ncargo build\ncd target/debug\n./cozad-union-find -n ../../data/nodes_small.txt -c ../../data/connections_small.txt\n\n```\n\nExample Output\n```\nNode File: ../../data/nodes_small.txt\nProcessing nodes file...\nNodes file processed\nBulk adding nodes...\nNodes bulk added\n\nConnections File: ../../data/connections_small.txt\nProcessing connections file...\nConnections file processed\nBulk connecting nodes...\nNodes bulk connected\n\nDisjoint sets found: 2\n```\n\n## Run the tests\n\n```\ncargo test\n```\n\n# Concepts\n - What is a disjoint set?\n   - Disjoint sets have no items in common between each set\n   - https://en.wikipedia.org/wiki/Disjoint_sets\n - Why would I use this?\n   - You have a large un-directed graph and you want to find non overlapping sets, such as for\n   - 2D and 3D Percolation\n   - Disease exposure\n   - Contact tracing\n   - Labeling clusters\n - How can I learn more?\n   - https://algs4.cs.princeton.edu/15uf/\n   - Purchase access to the full support videos\n     - Includes detailed coverage of theory, code, and tests\n     - Coming soon!\n\n# Support\n - How do I request a change?\n   - Please submit an issue or a pull request\n - How fast will my request be added?\n   - Probably not very fast for requests outside of a support package because this repo is maintained by a working professional\n   - If you require fast, predictable responses, please purchase a support package\n - Can support package be purchased?\n   - Yes, various support packages can be purchased and customized for your needs. Support areas available include:\n   - On demand support videos\n   - 1:1 and team coaching\n   - New features and other modifications\n\n## License\n\nLicensed under\n\n - MIT license\n   ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccozad%2Fcozad-union-find","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fccozad%2Fcozad-union-find","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccozad%2Fcozad-union-find/lists"}