C Directed Graph Implementation Choice

Welcome mon amie,

In some homework of mine, I feel the need to use the Graph ADT. However, I'd like to have it, how do I say, generic. That is to say, I want to store in it whatever I fancy.

The issue I'm facing, has to do with complexity. What data structure should I use to represent the set of nodes? I forgot to say that I already decided to use the Adjacency list technic.

Generally, textbooks mention a linked list, but, it is to my understanding that whenever a linked list is useful and we need to perform searches, a tree is better.

But then again, what we need is to associate a node with its list of adjacent nodes, so what about an hash table?

Can you help me decide in which data structure (linked list, tree, hash table) should i store the nodes?

7
задан Bill the Lizard 19 September 2012 в 16:29
поделиться