I have the following dictionary representing id:parent. {1: 2, 3: 1}
.
I need to loop and check if id == parent
then it is a child.
For example here:
1=1
so 3
is the child of 1
.
I will append it to the dictionary accordingly. Any ideas?
d={1:2, 3:1}
for node in d: