{"id":22967783,"url":"https://github.com/jabolopes/go-sparseset","last_synced_at":"2025-03-21T09:25:06.593Z","repository":{"id":65817281,"uuid":"526986001","full_name":"jabolopes/go-sparseset","owner":"jabolopes","description":"Sparse sets with efficient traversal, joining, sorting, etc.","archived":false,"fork":false,"pushed_at":"2024-07-29T18:54:43.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T06:11:10.374Z","etag":null,"topics":["data-structures","generics","go","golang","golang-library","sets","sparse-sets","utility"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jabolopes.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-20T16:51:32.000Z","updated_at":"2024-07-29T18:54:46.000Z","dependencies_parsed_at":"2023-02-22T20:01:06.492Z","dependency_job_id":"c326430d-e83c-455e-b255-fa8b38aa8143","html_url":"https://github.com/jabolopes/go-sparseset","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/jabolopes%2Fgo-sparseset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabolopes%2Fgo-sparseset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabolopes%2Fgo-sparseset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabolopes%2Fgo-sparseset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jabolopes","download_url":"https://codeload.github.com/jabolopes/go-sparseset/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244769368,"owners_count":20507433,"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":["data-structures","generics","go","golang","golang-library","sets","sparse-sets","utility"],"created_at":"2024-12-14T21:14:43.476Z","updated_at":"2025-03-21T09:25:06.569Z","avatar_url":"https://github.com/jabolopes.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-sparseset\n\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/jabolopes/go-sparseset)](https://pkg.go.dev/github.com/jabolopes/go-sparseset)\n\nThis library provides an implementation of [sparse\nsets](https://dl.acm.org/doi/10.1145/176454.176484) and utilities to operate on\nsparse sets, including, efficient traversal, joining, sorting, etc.\n\nValues are stored contiguously in memory therefore traversing a set is\nparticularly fast because it takes advantage of the underlying CPU caching.\n\n```go\n// Construction\nset := sparseset.New[string](4096, 1\u003c\u003c20)\n*set.Add(id) = value\n...\n\n// Properties.\nlength := set.Length()\n\n// Removal.\nset.Remove(id)\n\n// Lookup.\nif value, ok := set.Get(id); ok {\n  // Do something with value...\n} else {\n  // Set does not contain id...\n}\n\n// Traversal.\nfor iterator := sparseset.Iterate(set); ; {\n  key, value, ok := iterator.Next()\n  if !ok {\n    break\n  }\n\n  // Do something with key and value...\n}\n\n// Joining 2 sets.\nfor iterator := sparseset.Join(set1, set2); ; {\n  key, value1, value2, ok := iterator.Next()\n  if !ok {\n    break\n  }\n\n  // Do something with key, value1, and value2...\n}\n\n// Joining 3 sets.\nfor iterator := sparseset.Join3(set1, set2, set3); ; {\n  key, value1, value2, value3, ok := iterator.Next()\n  if !ok {\n    break\n  }\n\n  // Do something with key, value1, value2, and value3...\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjabolopes%2Fgo-sparseset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjabolopes%2Fgo-sparseset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjabolopes%2Fgo-sparseset/lists"}