In the class networkx.MultiGraph
, an edge is keyed by (u, v, key)
, for instance, ('n1', 'n2', 'key1')
. I would like to draw edge labels (say weight, (u, v, key): 10
) for MultiGraph
by using the function networkx.draw_networkx_edge_labels
.
However, edge labels are keyed by a two-tuple (u, v)
in draw_networkx_edge_labels
, instead of a 3-tuple (u, v, key)
, as is the case in MultiGraph
. This raises ValueError: too many values to unpack
.
PS: The parameter edge_labels
in draw_networkx_edge_labels
is described as follows:
draw_networkx_edge_labels(
G, pos,
edge_labels=None, label_pos=0.5,
font_size=10, font_color='k',
font_family='sans-serif', font_weight='normal',
alpha=1.0, bbox=None, ax=None,
rotate=True, **kwds)
Edge labels in a dictionary of labels keyed by edge two-tuple. Only labels for the keys in the dictionary are drawn.
(Note the "two-tuple" in this description.)