Q:

data structure advice on c++

I am looking for data structure in c++ and I need an advice. 
I have nodes, every node has unique_id and group_id:
1 1.1.1.1
2 1.1.1.2
3 1.1.1.3

4 1.1.2.1
5 1.1.2.2
6 1.1.2.3

7 2.1.1.1
8 2.1.1.2

I need a data structure to answer those questions:

what is the group_id of node 4
give me list (probably vector) of unique_id's that belong to group 1.1.1
give me list (probably vector) of unique_id's that belong to group 1.1
give me list (probably vector) of unique_id's that belong to group 1

Is there a data structure that can answer those questions (what is the complexity time of inserting and answering)?  or should I implement it? 
I would appreciate an example. 
EDIT:
at the beginning, I need to build this data structure.  most of the action is reading by group id.  insertion  will happen but less then reading. 
the time complexity is more important than memory space

A:

To me, hierarchical data like the group ID calls for a tree structure. ( I assume that for 500 elements this is not really necessary, but it seems natural and scales well.)  
Each element in the first two levels of the tree would just hold vectors (if they come ordered) or maps (if they come un-ordered) of sub-IDs.  
The third level in the tree hierarchy would hold pointers to leaves, again in a vector or map, which contain the fourth group ID part and the unique ID. 
Questions 2-4 are easily and quickly answered by navigating the tree. 
For question 1 one needs an additional map from unique IDs to leaves in the tree; each element inserted into the tree also has a pointer to it inserted into the map. 

A:

First of all, if you are going to have only a small number of nodes then it would probably make sense not to mess with advanced data structuring.  Simple linear search could be sufficient. 
Next, it looks like a good job for SQL.  So may be it's a good idea to incorporate into your app SQLite library.  But even if you really want to do it without SQL it's still a good hint: what you need are two index trees to support quick searching through your array.  The complexity (if using balanced trees) will be logarithmic for all operations.