I have created a graph using networkx. When I draw this graph the node labels do not fit (node names can be pretty long), so I have replaced them by numeric indices. The problem with this workaround is that the resulting drawing is harder to interpret as those numbers are meaningless. This is my code:
import networkx as nx
import matplotlib.pyplot as plt
G = nx.Graph()
G.add_nodes_from(['First', 'Second', 'Third'])
G.add_edges_from([('First', 'Second'), ('First', 'Third'), ('Second', 'Third')])
name2num = {name: num + 1 for num, name in enumerate(list(G.nodes))}
H = nx.relabel_nodes(G, mapping=name2num, copy=True)
fig, (ax0, ax1) = plt.subplots(1, 2)
nx.draw(G, ax=ax0, with_labels=True)
nx.draw(H, ax=ax1, with_labels=True)

My question is: how could I add a key to the drawing on the right?
This is the information I'd like to display:
1 - First
2 - Second
3 - Third
I tried to add a legend, to no avail:
ax0.legend(list(name2num.values()), list(name2num.keys()))
PS: I found a number of threads related to my problem. The proposed solutions consist in encoding the node labels through different colors. I'd rather prefer to encode the node labels through numbers.

