add labels to networkx graph code example
Example 1: networkx plot graph show labels
import networkx as nx
import pylab as plt
G=nx.Graph()
# Add nodes and edges
G.add_edge("Node1", "Node2")
nx.draw(G, with_labels = True)
plt.savefig('labels.png')
Example 2: networkx draw labels
>>> G.number_of_nodes()
8
>>> G.number_of_edges()
3