Drawing networkx graph with label

I am able to make a graph but I cannot label the nodes in the graph, I am interested in simply labeling the nodes with their names. I passed the nodes and node's name as a dictionary but I got error:

KeyError: 6

the dictionary looks like this:

labeldict= {0: tensor(2), 1: tensor(2), 2: tensor(0), 3: tensor(1), 4: tensor(1), 5: tensor(0)}

my code:

for i in range(5):
      g = torch_geometric.utils.to_networkx(graphData[i], to_undirected=True)
      nx.draw(g,labels=labeldict, with_labels=True)
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum