{"id":15009974,"url":"https://github.com/wroberts/pyredblack","last_synced_at":"2025-07-14T22:32:56.846Z","repository":{"id":27876856,"uuid":"31367975","full_name":"wroberts/pyredblack","owner":"wroberts","description":"Cython interface to red-black trees implemented in C++","archived":false,"fork":false,"pushed_at":"2019-11-25T17:52:13.000Z","size":73,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-15T04:08:36.077Z","etag":null,"topics":["balanced-search-trees","binary-search-tree","data-structure","python","python-2","python-3","red-black-tree"],"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/wroberts.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.rst","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-26T13:21:38.000Z","updated_at":"2021-11-27T01:41:44.000Z","dependencies_parsed_at":"2022-09-03T20:22:44.321Z","dependency_job_id":null,"html_url":"https://github.com/wroberts/pyredblack","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/wroberts/pyredblack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wroberts%2Fpyredblack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wroberts%2Fpyredblack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wroberts%2Fpyredblack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wroberts%2Fpyredblack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wroberts","download_url":"https://codeload.github.com/wroberts/pyredblack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wroberts%2Fpyredblack/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265360327,"owners_count":23752682,"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":["balanced-search-trees","binary-search-tree","data-structure","python","python-2","python-3","red-black-tree"],"created_at":"2024-09-24T19:29:19.687Z","updated_at":"2025-07-14T22:32:56.824Z","avatar_url":"https://github.com/wroberts.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"============\n pyredblack\n============\n\n.. image:: https://travis-ci.org/wroberts/pyredblack.svg?branch=master\n    :target: https://travis-ci.org/wroberts/pyredblack\n\n.. image:: https://coveralls.io/repos/wroberts/pyredblack/badge.svg?branch=master\n  :target: https://coveralls.io/r/wroberts/pyredblack?branch=master\n     :alt: Test code coverage\n\n.. image:: https://img.shields.io/pypi/v/pyredblack.svg\n    :target: https://pypi.python.org/pypi/pyredblack/\n    :alt: Latest Version\n\nCopyright (c) 2015 Will Roberts \u003cwildwilhelm@gmail.com\u003e\n\nLicensed under the MIT License (see ``LICENSE.rst`` for details).\n\nCython interface to red-black trees implemented in C++.\n\n`Red-black trees`_ are a kind of `self-balancing binary tree`_.  They\nmaintain their entries in sorted order and have O(log n) for\ninsertion, lookup, and deletion.  You can `read more about red-black\ntrees`_ and `see animations of insertion, lookup, and deletion`_.\n\n.. _`Red-black trees`: http://en.wikipedia.org/wiki/Red%E2%80%93black_tree\n.. _`self-balancing binary tree`: http://en.wikipedia.org/wiki/Self-balancing_binary_search_tree\n.. _`read more about red-black trees`: http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_rbtree.aspx\n.. _`see animations of insertion, lookup, and deletion`: https://www.cs.usfca.edu/~galles/visualization/RedBlack.html\n\nThis package provides dictionary and set objects based on\nred-black-trees; these can be used as drop-in replacements for the\nbuilt-in ``dict`` and ``set`` types, except that they maintain their\ncontents in sorted order.\n\nDictionary (``rbdict``)::\n\n    \u003e\u003e\u003e import pyredblack\n    \u003e\u003e\u003e d = pyredblack.rbdict(Germany = 'Berlin',\n                              Hungary = 'Budapest',\n                              Ireland = 'Dublin',\n                              Portugal = 'Lisbon',\n                              Cyprus = 'Nicosia',\n                              Greenland = 'Nuuk',\n                              Iceland = 'Reykjavik',\n                              Macedonia = 'Skopje',\n                              Bulgaria = 'Sofia',\n                              Sweden = 'Stockholm')\n    \u003e\u003e\u003e len(d)\n    10\n    \u003e\u003e\u003e d['Ireland']\n    'Dublin'\n    \u003e\u003e\u003e d.keys()\n    ['Bulgaria', 'Cyprus', 'Germany', 'Greenland', 'Hungary',\n     'Iceland', 'Ireland', 'Macedonia', 'Portugal', 'Sweden']\n    \u003e\u003e\u003e d.values()\n    ['Sofia', 'Nicosia', 'Berlin', 'Nuuk', 'Budapest',\n     'Reykjavik', 'Dublin', 'Skopje', 'Lisbon', 'Stockholm']\n    \u003e\u003e\u003e d.popitem()\n    ('Bulgaria', 'Sofia')\n    \u003e\u003e\u003e d.popitem()\n    ('Cyprus', 'Nicosia')\n    \u003e\u003e\u003e d.popitem()\n    ('Germany', 'Berlin')\n\nSet (``rbset``)::\n\n    \u003e\u003e\u003e fruit = pyredblack.rbset(['apple', 'orange', 'apple', 'pear',\n                                  'orange', 'banana'])\n    \u003e\u003e\u003e 'orange' in fruit\n    True\n    \u003e\u003e\u003e 'crabgrass' in fruit\n    False\n    \u003e\u003e\u003e a = pyredblack.rbset('abracadabra')\n    \u003e\u003e\u003e b = pyredblack.rbset('alacazam')\n    \u003e\u003e\u003e list(a)\n    ['a', 'b', 'c', 'd', 'r']\n    \u003e\u003e\u003e list(a - b)\n    ['b', 'd', 'r']\n    \u003e\u003e\u003e list(a | b)\n    ['a', 'b', 'c', 'd', 'l', 'm', 'r', 'z']\n    \u003e\u003e\u003e list(a \u0026 b)\n    ['a', 'c']\n    \u003e\u003e\u003e list(a ^ b)\n    ['b', 'd', 'l', 'm', 'r', 'z']\n    \u003e\u003e\u003e a.pop()\n    'a'\n    \u003e\u003e\u003e a.pop()\n    'b'\n    \u003e\u003e\u003e a.pop()\n    'c'\n\nRequirements\n------------\n\n- Python 2.7, Python 3.2+\n- Cython (and a C++ compiler)\n\nTodo\n----\n\n- implement slicing on dictionaries\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwroberts%2Fpyredblack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwroberts%2Fpyredblack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwroberts%2Fpyredblack/lists"}