简体   繁体   English

C#父/子数据结构的可用性?

[英]C# parent/child data structure availability?

is this type of data structures available in c# or as a free class library somewhere? 这种数据结构在c#中还是在某个地方的免费类库中可用?

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. 我找到了为Quicklight和.net3.5编译的QuickGraph库 It also contains AI algorithms and other advance searching. 它还包含AI算法和其他高级搜索。

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. MSDN上有一篇不错的文章,内容涉及实现数据结构,它将为您提供所需的内容。 See An Extensive Examination of Data Structures Using C# 2.0 查看使用C#2.0的数据结构的广泛检查

In particular look at part 5 on graphs. 特别要看图的第5部分。

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. 尽管我一直在研究的应用程序并没有过分关注大型结构或高搜索性能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM