{"id":24399635,"url":"https://github.com/open-net-libraries/open.hierarchy","last_synced_at":"2026-02-26T10:01:23.180Z","repository":{"id":79496991,"uuid":"108598360","full_name":"Open-NET-Libraries/Open.Hierarchy","owner":"Open-NET-Libraries","description":"Interfaces and classes helful in managing tree-like data structures.","archived":false,"fork":false,"pushed_at":"2024-11-17T00:35:05.000Z","size":120,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-14T02:22:45.691Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","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/Open-NET-Libraries.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":"2017-10-27T21:41:15.000Z","updated_at":"2024-11-17T00:35:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"225e119b-0690-4afe-aa0b-6991c3c3eacf","html_url":"https://github.com/Open-NET-Libraries/Open.Hierarchy","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Open-NET-Libraries/Open.Hierarchy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-NET-Libraries%2FOpen.Hierarchy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-NET-Libraries%2FOpen.Hierarchy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-NET-Libraries%2FOpen.Hierarchy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-NET-Libraries%2FOpen.Hierarchy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Open-NET-Libraries","download_url":"https://codeload.github.com/Open-NET-Libraries/Open.Hierarchy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-NET-Libraries%2FOpen.Hierarchy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259935588,"owners_count":22934384,"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":[],"created_at":"2025-01-19T23:50:42.824Z","updated_at":"2026-02-26T10:01:18.160Z","avatar_url":"https://github.com/Open-NET-Libraries.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Open.Hierarchy\n\n[![NuGet](https://img.shields.io/nuget/v/Open.Hierarchy.svg)](https://www.nuget.org/packages/Open.Hierarchy/)\n\n## Introduction\n\nOpen.Hierarchy is a versatile library designed for creating and manipulating tree structures with a focus on efficiency and ease of use. With the `Node\u003cT\u003e` class and its supporting components, this library enables users to create tree structures that have a unidirectional parent-to-child relationship, enabling more efficient use of memory and simplified garbage collection.\n\n## `Node\u003cT\u003e`\n\n`Node\u003cT\u003e` is a versatile class that represents a node in a bidirectional tree. It can be used as-is or to act as a bidirectional map of a unidirectional tree. In a bidirectional tree, it is crucial to ensure that a node cannot occur multiple times, although its value can occur any number of times. This approach enables the creation of 'value sub-trees' with duplicate references but not duplicate instances. By using `Node\u003cT\u003e` as a container, a single instance can exist multiple times in a tree but still be uniquely identifiable by its position.\n\n## `Node\u003cT\u003e.Factory`\n\nThe `Node\u003cT\u003e.Factory` class provides useful methods for creating, mapping, cloning, and recycling `Node\u003cT\u003e` instances:\n\n### Blank Instance\n\n- `.GetBlankNode()`: Retrieves a blank node from the underlying object pool or creates a new one.\n\n### Mapping\n\n- `.Map(root)`: Generates a node hierarchy map based on whether the root or any of its children implement the `IParent` interface.\n\n### Cloning\n\n- `.Clone(node)`: Creates a copy of the node map.\n\n### Recycling\n\n- `Factory.Recycle(node)`: Recycles a `Node\u003cT\u003e` instance by tearing down the node itself and its children, returning them to an object pool.\n\n**WARNING:** The `Factory.Recycle(node)` method is a potential source of issues if multiple references are retained. It must be used with care to avoid unexpected behavior.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-net-libraries%2Fopen.hierarchy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopen-net-libraries%2Fopen.hierarchy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-net-libraries%2Fopen.hierarchy/lists"}