I have an adjacency dictionary like this:
dic = {31: {88, 42}, 42: {53}, 55: {88, 99, 77}, 77: {88}, 53: {88, 44}, 44: {55}, 88: {99}, 99: {77}}