You can simply use a multimap, better the hash_multimap.
No I can't! Sorry because of not mentionning the right thing. I can't because the objects I needed are not ordered.
To represent a tree, enumerate your knots. For every father knot, map its id to the id of its childreen ( and maybee additional data) A knot that cannot be found in the map, is a leaf. I you want to traverse the tree in the leaf to root direction, simply create a predecessor map (using a simple vector for example). That map stores the father for each child.
Does the method you mentioned work for my problem in which there is no ordering? If yes, please explain it in more detail (with an example). Thank you, --Hossein __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com