{"id":13822480,"url":"https://github.com/laysakura/louds-rs","last_synced_at":"2025-10-24T21:40:03.442Z","repository":{"id":62442465,"uuid":"183347238","full_name":"laysakura/louds-rs","owner":"laysakura","description":"High performance LOUDS (Level-Order Unary Degree Sequence) library","archived":false,"fork":false,"pushed_at":"2024-07-19T09:13:07.000Z","size":5461,"stargazers_count":28,"open_issues_count":2,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-30T07:06:55.521Z","etag":null,"topics":["louds","rust","succinct-data-structure"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/louds-rs","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/laysakura.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2019-04-25T03:12:12.000Z","updated_at":"2024-08-04T11:33:48.000Z","dependencies_parsed_at":"2024-12-16T04:06:15.151Z","dependency_job_id":"c67873d8-ec38-400d-ac15-01b652574737","html_url":"https://github.com/laysakura/louds-rs","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laysakura%2Flouds-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laysakura%2Flouds-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laysakura%2Flouds-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laysakura%2Flouds-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laysakura","download_url":"https://codeload.github.com/laysakura/louds-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248547202,"owners_count":21122468,"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":["louds","rust","succinct-data-structure"],"created_at":"2024-08-04T08:02:01.981Z","updated_at":"2025-10-24T21:39:58.419Z","avatar_url":"https://github.com/laysakura.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# louds-rs\n\nHigh performance LOUDS (Level-Order Unary Degree Sequence) library.\n\n[Master API Docs](https://laysakura.github.io/louds-rs/louds_rs/)\n|\n[Released API Docs](https://docs.rs/crate/louds-rs)\n|\n[Benchmark Results](https://laysakura.github.io/louds-rs/criterion/report/)\n|\n[Changelog](https://github.com/laysakura/louds-rs/blob/master/CHANGELOG.md)\n\n[![GitHub Actions Status](https://github.com/laysakura/louds-rs/actions/workflows/clippy.yml/badge.svg)](https://github.com/laysakura/louds-rs/actions)\n[![Travis Status](https://travis-ci.com/laysakura/louds-rs.svg?branch=master)](https://travis-ci.com/laysakura/louds-rs)\n[![Crates.io Version](https://img.shields.io/crates/v/louds-rs.svg)](https://crates.io/crates/louds-rs)\n[![Crates.io Downloads](https://img.shields.io/crates/d/louds-rs.svg)](https://crates.io/crates/louds-rs)\n[![Minimum rustc version](https://img.shields.io/badge/rustc-1.33+-lightgray.svg)](https://github.com/laysakura/louds-rs#rust-version-supports)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/laysakura/louds-rs/blob/master/LICENSE-MIT)\n[![License: Apache 2.0](https://img.shields.io/badge/license-Apache_2.0-blue.svg)](https://github.com/laysakura/louds-rs/blob/master/LICENSE-APACHE)\n\n## Quickstart\n\nTo use louds-rs, add the following to your `Cargo.toml` file:\n\n```toml\n[dependencies]\nlouds-rs = \"0.1\"  # NOTE: Replace to latest minor version.\n```\n\n### Usage Overview\nSay we want to hold the following tree structure in minimum length of bits.\n\n```plaintext\n(1)\n |\n |---+---+\n |   |   |\n(2) (3) (4)\n |       |\n |       |---+-----+\n |       |   |     |\n(5)     (6) (7)   (8)\n             |     |\n             |     |----+\n             |     |    |\n            (9)   (10) (11)\n```\n\nThis tree has NodeNum (node number of 1-origin, assigned from left node to right \u0026 top to bottom) and edges.\nWith LOUDS, this tree is represented as the following LBS (LOUDS Bit String).\n\n```plaintext\nNodeNum       | 0 (virtual root) | 1          | 2    | 3 | 4          | 5 | 6 | 7    | 8       | 9 | 10 | 11 |\nLBS           | 1  0             | 1  1  1  0 | 1  0 | 0 | 1  1  1  0 | 0 | 0 | 1  0 | 1  1  0 | 0 | 0  | 0  |\nChild NodeNum | 1  -             | 2  3  4  - | 5  - | - | 6  7  8  - | - | - | 9  - | 10 11 - | - | -  | -  |\nIndex         | 0  1             | 2  3  4  5 | 6  7 | 8 | 9  10 11 12| 13| 14| 15 16| 17 18 19| 20| 21 | 22 |\n```\n\nThe same tree is represented as follows using index.\n\n```plaintext\n\u003c0\u003e\n |\n |---+---+\n |   |   |\n\u003c2\u003e \u003c3\u003e \u003c4\u003e\n |       |\n |       |---+-----+\n |       |   |     |\n\u003c6\u003e     \u003c9\u003e \u003c10\u003e  \u003c11\u003e\n             |     |\n             |     |----+\n             |     |    |\n            \u003c15\u003e  \u003c17\u003e \u003c18\u003e\n```\n\nThen, create this tree structure with `Louds` and call operations to it.\n\n```rust\nuse louds_rs::{Louds, LoudsIndex, LoudsNodeNum};\n\n// Construct from LBS.\nlet s = \"10_1110_10_0_1110_0_0_10_110_0_0_0\";\nlet louds = Louds::from(s);\n\n// LoudsNodeNum \u003c-\u003e LoudsIndex\nlet node8 = LoudsNodeNum(8);\nlet index11 = louds.node_num_to_index(node8);\nassert_eq!(louds.index_to_node_num(index11), node8);\n\n// Search for children.\nassert_eq!(louds.parent_to_children(node8), vec!(LoudsIndex(17), LoudsIndex(18)));\n\n// Search for parent.\nassert_eq!(louds.child_to_parent(index11), LoudsNodeNum(4));\n```\n\n### Constructors\n\n```rust\nuse louds_rs::Louds;\n\n// Most human-friendly way: Louds::from::\u003c\u0026str\u003e()\nlet louds1 = Louds::from(\"10_1110_10_0_1110_0_0_10_110_0_0_0\");\n\n// Simple way: Louds::from::\u003c\u0026[bool]\u003e()\nlet mut arr = vec![\n    true, false,\n    true, true, true, false,\n    true, false,\n    false,\n    true, true, true, false,\n    false,\n    false,\n    true, false,\n    true, true, false,\n    false,\n    false,\n    false,\n];\nlet louds2 = Louds::from(\u0026arr[..]);\n```\n\n## Features\n- **Arbitrary length support with minimum working memory**: louds-rs provides virtually _arbitrary size_ of LOUDS. It is carefully designed to use as small memory space as possible.\n- **Based on [fid-rs](https://crates.io/crates/fid-rs)**, which is fast, parallelized, and memory efficient. It provides fast construction (`Louds::from()`).\n- **Latest benchmark results are always accessible**: louds-rs is continuously benchmarked in Travis CI using [Criterion.rs](https://crates.io/crates/criterion). Graphical benchmark results are published [here](https://laysakura.github.io/louds-rs/criterion/report/).\n\n### Complexity\nWhen the number of nodes in the tree represented as LOUDS is _N_:\n\n| Operation | Time-complexity | Space-complexity |\n|-----------|-----------------|------------------|\n| [`Louds::from::\u003c\u0026str\u003e()`](https://laysakura.github.io/louds-rs/louds_rs/louds/struct.Louds.html#implementations) | _O(N)_ | _N + o(N)_ |\n| [`Louds::from::\u003c\u0026[bool]\u003e()`](https://laysakura.github.io/louds-rs/louds_rs/louds/struct.Louds.html#implementations) | _O(N)_ | _N + o(N)_ |\n| [`node_num_to_index()`](https://laysakura.github.io/louds-rs/louds_rs/louds/struct.Louds.html#method.node_num_to_index) | _O()_ | _N + o(N)_ |\n| [`index_to_node_num()`](https://laysakura.github.io/louds-rs/louds_rs/louds/struct.Louds.html#method.index_to_node_num) | _O(1)_ | _O(1)_ |\n| [`child_to_parent()`](https://laysakura.github.io/louds-rs/louds_rs/louds/struct.Louds.html#method.child_to_parent) | _O(1)_ | _O(1)_ |\n| [`parent_to_children()`](https://laysakura.github.io/louds-rs/louds_rs/louds/struct.Louds.html#method.parent_to_children) | _O( max(log N, \u003cu\u003emax num of children a node has\u003c/u\u003e) )_ | _O( max(log N, \u003cu\u003emax num of children a node has\u003c/u\u003e) )_ |\n| [`parent_to_children_indices()`](https://laysakura.github.io/louds-rs/louds_rs/louds/struct.Louds.html#method.parent_to_children) | _O(1)_ | _O( 1 )_ |\n| [`parent_to_children_indices().next()`](https://laysakura.github.io/louds-rs/louds_rs/louds/struct.Louds.html#method.parent_to_children) | _O(log N)_ at first then _O(1)_ | _O( 0 )_ |\n| [`parent_to_children_indices().next_back()`](https://laysakura.github.io/louds-rs/louds_rs/louds/struct.Louds.html#method.parent_to_children) | _O(log N)_ at first then _O(1)_ | _O( 0 )_ |\n\n(`node_num_to_index()` and `child_to_parent()` use [Fid::select()](https://laysakura.github.io/fid-rs/fid_rs/fid/struct.Fid.html#method.select). `index_to_node_num()` and `parent_to_children()` use [rank()](https://laysakura.github.io/fid-rs/fid_rs/fid/struct.Fid.html#method.rank)). `parent_to_children_nodes()` has the same time complexity as `parent_to_children_indices()`.\n\n## Versions\nlouds-rs uses [semantic versioning](http://semver.org/spec/v2.0.0.html).\n\nSince current major version is _0_, minor version update might involve breaking public API change (although it is carefully avoided).\n\n## Rust Version Supports\n\nlouds-rs is continuously tested with these Rust versions in Travis CI:\n\n- 1.33.0\n- Latest stable version\n\nSo it expectedly works with Rust 1.33.0 and any newer versions.\n\nOlder versions may also work, but are not tested or guaranteed.\n\n## Contributing\n\nAny kind of pull requests are appreciated.\n\n### Guidelines\n\n- `README.md` is generated from `$ cargo readme` command. Do not manually update `README.md` but edit `src/lib.rs` and then `$ cargo readme \u003e README.md`.\n- Travis CI automatically does the following commit \u0026 push to your pull-requests:\n    - `$ cargo readme \u003e README.md`\n    - `$ cargo fmt --all`\n\n## License\n\nMIT OR Apache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaysakura%2Flouds-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaysakura%2Flouds-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaysakura%2Flouds-rs/lists"}