开发者

C# parent/child data structure availability?

is this type of data structures available in c# o开发者_如何转开发r as a free class library somewhere?

I want a multiple parent, multiple child type of data structure such as:

public class Many2ManyNode
{
    public List<Object> Parents;
    public List<Object> Children;
}

Its like a tree structure but with multiple parents and multiple child.


I'll stand by my previous comments that it looks like you want a directed graph (depending on how you want to use this structure), but if you just wanted to make your code better reflect what you're asking for it would be:

public class Node
{
    public List<Node> Parents;
    public List<Node> Children;
}


I found this QuickGraph library which was both compiled for silverlight and .net3.5. It also contains AI algorithms and other advance searching.


I'm not aware of any data structure in the framework that does what you are after.

There is a nice MSDN post that covers implementing data structures that will give you what you want. See An Extensive Examination of Data Structures Using C# 2.0

In particular look at part 5 on graphs.


You could try this library. Not sure if that will help or not. Generally I've found that I could aggregate the available generic classes to build the data structures that I have needed. Although the applications I have been working on were not overly concerned with large structures or high search performance.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜