{"id":22901061,"url":"https://github.com/mpdn/radix-heap","last_synced_at":"2025-08-08T04:33:42.950Z","repository":{"id":42004486,"uuid":"52978596","full_name":"mpdn/radix-heap","owner":"mpdn","description":"Radix heap implementation in Rust","archived":false,"fork":false,"pushed_at":"2024-04-25T17:38:36.000Z","size":1740,"stargazers_count":33,"open_issues_count":3,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-22T21:46:40.471Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/mpdn.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,"zenodo":null}},"created_at":"2016-03-02T16:34:37.000Z","updated_at":"2025-02-13T12:37:49.000Z","dependencies_parsed_at":"2024-12-14T01:31:40.024Z","dependency_job_id":"217583a6-8247-484d-8149-845585ddd1b9","html_url":"https://github.com/mpdn/radix-heap","commit_stats":{"total_commits":50,"total_committers":7,"mean_commits":7.142857142857143,"dds":0.38,"last_synced_commit":"8d3ccc17789ca0717b2520bbb19486c2c96f0d04"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mpdn/radix-heap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpdn%2Fradix-heap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpdn%2Fradix-heap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpdn%2Fradix-heap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpdn%2Fradix-heap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mpdn","download_url":"https://codeload.github.com/mpdn/radix-heap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpdn%2Fradix-heap/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269365469,"owners_count":24405229,"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-08-08T02:00:09.200Z","response_time":72,"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":[],"created_at":"2024-12-14T01:31:30.107Z","updated_at":"2025-08-08T04:33:42.913Z","avatar_url":"https://github.com/mpdn.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# radix-heap\n\nFast monotone priority queues.\n\nA monotone priority queue is a priority queue that requires the extracted elements follow a\nmonotonic sequence. This means that, for a max-radix-heap, you cannot insert an element into a\nradix heap that is larger than the last extracted element.\n\nThe key of the last extracted element is called the \"top\" key of the radix heap. Thus any value\npushed onto the heap must be less than or equal to the top key.\n\nIn return for this restriction, the radix heap provides two major benefits:\n\n- Inserts are `O(1)` and popping an element is amortized `O(log m)` where `m` is the difference\n  between a popped key and the top key at the time the element was inserted.\n  \n  Note that this is independent of the number of elements in the radix heap. This means that for\n  workloads where this difference is bounded by a constant, the radix heap has O(1) pop.\n\n- It is trivial to implement first-in-last-out order for equal keys in a radix heap. When\n  implementing pathfinding, this corresponds to \"tie-breaking\" which can significantly improve\n  performance. This is also possible to implement with a binary heap, but comes for free with a\n  radix heap.\n\n- A radix heap has generally better cache coherence than a binary heap.\n\n# Performance\n\nHere is a summary of the benchmarks from running them on my machine:\n\n```text\nastar_radix             time:   [2.6594 us 2.6622 us 2.6651 us]\nastar_binary            time:   [5.3698 us 5.3762 us 5.3827 us]\npushpop_radix           time:   [97.601 us 97.784 us 97.987 us]\npushpop_binary          time:   [507.28 us 507.44 us 507.60 us]\n```\n\n`astar` is a benchmark using a map from the\n[2D Pathfinding Banchmarks](https://movingai.com/benchmarks/grids.html).\n\n`pushpop` is a more heap-focused benchmark where values are repeatedly pushed and popped off a heap.\n\n# Example\n\n```\nextern crate radix_heap;\nlet mut heap = radix_heap::RadixHeapMap::new();\n\nheap.push(7, 'a');\nheap.push(2, 'b');\nheap.push(9, 'c');\n\nassert!(heap.top() == None);\nassert!(heap.pop() == Some((9, 'c')));\nassert!(heap.top() == Some(9));\nassert!(heap.pop() == Some((7, 'a')));\nassert!(heap.top() == Some(7));\nassert!(heap.pop() == Some((2, 'b')));\nassert!(heap.top() == Some(2));\nassert!(heap.pop() == None);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpdn%2Fradix-heap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpdn%2Fradix-heap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpdn%2Fradix-heap/lists"}