I have the following flatten dictionary containing one entry for each item and each item contains a parent and children attribute.
{
'a': {
parent: None,
children: ['b', 'c', 'd']
},
'b': {
parent: 'a',
children: ['e', 'f', 'g']
},
'c': {
parent: 'a',
children: []
},
'd': {
parent: 'a',
children: []
},
'e': {
parent: 'b',
children: []
},
'f': {
parent: 'b',
children: ['h']
},
'g': {
parent: 'b',
children: []
},
'h': {
parent: 'f',
children: []
},
}
How can I turn it into a nested dictionary which looks like this?
{
'a': {
'b': {
'e': {},
'f': {
'h':
}
'g': {}
},
'c': {},
'd': {},
}
}