开发者

Tree<String> Data Structure in C#

开发者 https://www.devze.com 2023-01-23 07:03 出处:网络
Good开发者_C百科 morning, Is there any good, efficient and good-performance n-ary tree data structure implementation for C#? I don\'t need any flexibility regarding the type of the nodes, since I onl

Good开发者_C百科 morning,

Is there any good, efficient and good-performance n-ary tree data structure implementation for C#? I don't need any flexibility regarding the type of the nodes, since I only need to store strings. However, I would like fast lookup time. Also, I need to label "edges" of the tree with (short) integers, but these labels can well be stored at each node.

Thank you very much.


Have you tried this?

public class CustomTreeNode
{
    public String Label { get; set; }
    public List<CustomTreeNode> Children { get; set; }
}

Also, you can always try TreeNode class.


Not directly, but there's a pretty good example here:

Tree example


You can use XElement to build a tree. This is not exactly what you are looking for, but still it can be useful.

http://msdn.microsoft.com/en-us/library/bb387089.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号