You can use this command to return all the children/descendent ID of a certain panel/group:
# get direct children ids:
directChildren = cmds.MGPickerItem(panelId, q=True, children=0)
# get all descendent ids:
allDescendents = cmds.MGPickerItem(panelId, q=True, children=1)
You can also query any picker item's parent id:
parent = cmds.MGPickerItem(itemId, q=True, parent=True)