I just did a walkaround with a list.
dis = dict(nx.all_pairs_shortest_path_length(graph))
Nations = list(dis.keys()) master = [[""]] for x in Nations: master.append(x) for Nat1 in dis: master.append([Nat1]) for Nat2 in Nations: master[-1].append(dis[Nat1][Nat2])
Thanks for everyone taking care of this problem. Have a wonderful day!
CLICK HERE to find out more related problems solutions.