I was looking for a tree or graph data structure in C# but I guess there isn\'t one provided. An Extensive Examination of Data Structures Using C# 2.0 explains a bit about w
Most trees are formed by the data you are processing.
Say you have a
personclass that includes details of someone’sparents, would you rather have the tree structure as part of your “domain class”, or use a separate tree class that contained links to your person objects? Think about a simple operation like getting all thegrandchildrenof aperson, should this code be in thepersonclass, or should the user of thepersonclass have to know about a separate tree class?
Another example is a parse tree in a compiler…
What both of these examples show is that the concept of a tree is part of the domain of the data and using a separate general purpose tree at least doubles the number of objects that are created as well as making the API harder to program again.
What we want is a way to reuse the standard tree operations, without having to re-implement them for all trees, while at the same time, not having to use a standard tree class. Boost has tried to solve this type of problem for C++, but I yet to see any effect for .NET get adapted.