I have this dictionary:
d1={
'a':['b','c','b'],
'b':['a','d','e']
}
it is sort of a directed graph. For example, d1['a'] points twice to 'b', and once to 'c' (see graph below)
What I want is to create two dictionaries out of d1 - pointing_to and pointed_by with values describing how many times they are pointing to or pointed by, respectively.
pointing_to={
'a':{'b':2,'c':1},
'b':{'a':1,'d':1,'e':1},
}
pointed_by={
'a':{'b':1},
'b':{'a':2},
'c':{'a':1},
'd':{'b':1},
'e':{'b':1}
}
