I want to create a weighted adjacency list (with weight=length) in Python from a graph that I downloaded.
Now, I struggle with creating such a list of the following form:
adjacency_list = { 'A': [('C', 8)],
'B': [(('A', 5), ('C', 1)], 'C': [('B', 12)]}
It is a directed Multigraph.
Please help :)
PS; I tried using adj_list = nx.to_dict_of_dicts(G, edge_data='length'), but instead of the actual length it just writes "length" every time.