T_Cyjb_Collections_TripleArrayCompress_2 - CYJB/Cyjb GitHub Wiki

TripleArrayCompress(TCur, TNext) 类

提供三数组压缩能力。

继承层次

System.Object
  Cyjb.Collections.TripleArrayCompress(TCur, TNext)
    Cyjb.Collections.TripleArrayCompress(T)
Namespace: Cyjb.Collections
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6

语法

C#

public class TripleArrayCompress<TCur, TNext>

类型参数

 

TCur
当前节点的类型。
TNext
下一节点的类型。
  The TripleArrayCompress(TCur, TNext) type exposes the following members.

构造函数

 

名称 说明
公共方法 TripleArrayCompress(TCur, TNext) 使用表示无效的节点值初始化 TripleArrayCompress(T) 类的新实例。
  Back to Top

属性

 

名称 说明
公共属性 Check 获取状态检查列表。
公共属性 Next 获取子节点列表。
  Back to Top

方法

 

名称 说明
公共方法 AddNode 添加指定的节点。
公共方法 Equals Determines whether the specified object is equal to the current object. (继承自 Object。)
受保护的方法 Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (继承自 Object。)
公共方法 GetHashCode Serves as the default hash function. (继承自 Object。)
公共方法 GetType Gets the Type of the current instance. (继承自 Object。)
受保护的方法 MemberwiseClone Creates a shallow copy of the current Object. (继承自 Object。)
公共方法 ToString Returns a string that represents the current object. (继承自 Object。)
  Back to Top

Remarks

三数组压缩一般用于压缩存储树/图的子节点,通过将到子节点的转移压缩到 base + next + check 三个数组内,在保持性能基本不变的前提下充分利用转移间的空格来减少内存使用。 假设使用 node[id] 来表示 id 对应的子节点,使用三数组表示时,若 base[node]check 范围内,且 check[base[node] + id] == node,那么 node[id] = next[base[node] + id];否则不存在 node[id]

要求下一节点的 key 不能重复,且子节点的索引必须大于等于零。

参见

Reference

Cyjb.Collections 命名空间

⚠️ **GitHub.com Fallback** ⚠️