1

I need to implement a data structure in C#/SQL Server that is a little bit tree and a little bit graph. I can think of how to brute force this, but performance is very important. That is where I need help.

Here are the requirements:

1) There are n root nodes.

2) Each node can have n children.

3) Each node is a list.

4) Each node can be related to another node or to an item in the nodes list.

5) The relations (edges?) have a type. Specifically nodes can have a loose relationship (all books in the library with the same subject), generational relationships (a tweak to recipe), variant relationships (a translation of a book).

6) Each node can have a weight.

I am not very well versed in data structures that aren't in the standard lexicon (list, tree, hash table, dictionary, etc). So there may be something out there that I am just not aware of. When I google "graph sql server" I get a lot of links about pretty graph controls for reports. Performance is critical, there can potentially be millions of nodes that need to be brought into memory. I'd even take a LMGTFY with a properly crafted query since I seem unable to express what I want. Any starting point would help.

2
  • Makes you wish you could use Neo4j, doesn't it? :-) Commented Oct 10, 2010 at 23:28
  • Does the weight of a node have a bearing on the relative performance required to access the node? Commented Oct 10, 2010 at 23:49

1 Answer 1

1

How about looking into the following CodeProject project: http://www.codeproject.com/KB/recipes/DotNet2Datastructures.aspx

It has a nice Graph<T> Implementation (among others). The unaltered code won't help with the relations you are specifying, but if you'll add them yourself it might be a good starting point.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.