TreeStructures 1.7.4

dotnet add package TreeStructures --version 1.7.4
NuGet\Install-Package TreeStructures -Version 1.7.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TreeStructures" Version="1.7.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TreeStructures --version 1.7.4
#r "nuget: TreeStructures, 1.7.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TreeStructures as a Cake Addin
#addin nuget:?package=TreeStructures&version=1.7.4

// Install TreeStructures as a Cake Tool
#tool nuget:?package=TreeStructures&version=1.7.4

Introduction

This is a C# library designed for effectively handling tree structures.
Emphasizing flexibility and extensibility, the library allows easy manipulation of various tree structures.

Features:

  1. Rich extension methods for ITreeNode<TNode>
  2. Achieving mutual references between parent and child nodes
  3. Classes forming a tree structure and their Generality
  4. Bidirectional Conversion between Different Data Structures and Tree Structures.

These are the four main features of the library.

Download Nuget Package

Usage

To be documented in the wiki.

Concept

This library does not aim to be standalone.
Various useful libraries are already available, so we aim to handle tree structure-related functions while coexisting with other libraries.

Let's elaborate on the four features mentioned at the beginning.

Rich Extension Methods

Over 60 extension methods for ITreeNode<TNode> are defined, including various overloads.
Examples include:

Enumeration: Preorder, Levelorder, all traversal methods, Leafs, Ancestors, DiscendArrivals, DescendTraces, etc.
Navigation: Root, NextSibling, LastSibling, etc.
Editing: Including TryAddChild, Try●●Child, Disassemble, RemoveAllDescendant, etc.
Parameter Retrieval: NodeIndex, NodePath, Height, Depth, etc.
Predicate Methods: IsDescendantOf, IsAncestorOf, IsRoot, etc.
Conversion: ToNodeMap, ToSerializableNodeMap, ToTreeDiagram, AsValuedTreeNode
Assembly Methods: Convert, AssembleTree, AssembleAsNAryTree

Mutual References Between Parent and Child Nodes

Mutual references between parent and child nodes are handled by base classes (TreeNodeBase<TNode> or HierarchyWrapper<TSrc,TWrpr>).

In the derived types of TreeNodeBase<TNode>, customization can be achieved through protected virtual methods such as RemoveChildProcess and InsertChildProcess, which are defined as ●●ChildProcess methods.

Classes Forming a Tree Structure and Their Generality

If you want to customize in detail, use TreeNodeBase<TNode>.
For a GeneralTree, if you want to use it as a data structure or container for data, use GeneralTreeNode<TNode> or ObservableTreeNode<TNode>.
If you want to use an N-Ary Tree with a fixed number of branches and empty nodes set to null, use NAryTreeNode<TNode>.
If you want to use it as a wrapper for objects or tree structure that forms the hierarchy, use (Hierarchy | TreeNode) Wrapper<TSrc,TWrpr>.
If you need to handle resource disposal and observation, along with its role as a wrapper (e.g., ViewModel in MVVM), inherit and use Bindable(Hierarchy | TreeNode)Wrapper<TSrc,TWrpr>.

In TreeNodeBase<TNode> and its derived types, you can customize the collections used internally and those exposed externally by overriding the Setup(Inner | Public)ChildCollection methods.
HierarchyWrapper<TSrc,TWrpr> and its derived types allow customization only of the collection exposed externally.

Bidirectional Conversion between Different Data Structures and Tree Structures.

Support is provided for exte ITreeNode<TNode> methods to objects that do not implement ITreeNode<TNode>.
This is achieved by wrapping objects in a HierarchyWrapper<TSrc,TWrpr> or BindableHierarchyWrapper<TSrc,TWrpr>, or by calling AsValuedTreeNode to provide the extension methods of ITreeNode<TNode>.

Furthermore, various methods for mutual conversion, such as Convert, AssembleTree, and ToNodeMap, are available through extension methods.

Namespaces Classification

TreeStructures;

 Abstract classes define generic tree nodes, peripheral objects, and event arguments.

Inheritance diagram of generic tree nodes
InheritanceGenericTreeNode

Inheritance diagram of NodePath and NodeIndex (peripheral objects)
InheritancePeripheralObjects

TreeStructures.Linq;

 Extension methods for ITreeNode<TNode>, IMutableTreeNode<TNode>, IEnumerable<T>

TreeStructures.Utility;

 Definition of ResultWithValue<T> used as a return value for Try●● methods

TreeStructures.Collections;

 It defines collections used in internal implementations or processing steps of extension methods.
 These include the synchronizable ImitableCollection<TSrc,TConv>,
 the combinable observable collection CombinableObservableCollection<T>,
 and the ReadOnlySortFilterObservableCollection<T> that applies sorting and filtering while synchronizing with an observable collection.

TreeStructures.EventManagement;

 Objects used in event handling, implementing Observable tree nodes

TreeStructures.Xml.Serialization;

 Dictionary and others used in serialization and deserialization

TreeStrucutures.Tree;

 Purpose-specific trees

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.7.4 87 1/31/2024
1.7.3 71 1/31/2024
1.7.2 75 1/31/2024
1.7.1 72 1/31/2024
1.7.0 73 1/30/2024
1.6.3 76 1/21/2024
1.6.2 76 1/21/2024
1.6.1 80 1/21/2024
1.6.0 75 1/21/2024
1.5.0 76 1/18/2024
1.4.6 91 1/14/2024
1.4.5 77 1/14/2024
1.4.4 74 1/10/2024
1.4.3 77 1/10/2024
1.4.1 75 1/8/2024
1.4.0 67 1/6/2024
1.3.1 70 1/3/2024
1.3.0 78 1/2/2024
1.2.0 126 12/30/2023
1.1.1 75 12/26/2023
1.1.0 93 12/21/2023
1.0.1 105 12/16/2023
1.0.0 107 12/14/2023