Context
While trying to set an attribute in a directional graph of in networkx, so not a node attribute but a graph attribute, I experienced the following error:
File "/some_path/some_filepy", line 81, in add_result_to_last_graph
snn_graphs[-1]["result"] = result_per_type
TypeError: 'DiGraph' object does not support item assignment
I did not quickly find an example on how to store attributes in a networkx graph in the documentation, so wondered:
Question
How can I store an attribute in a nx.DiGraph() object?