Artificial Intelligence, Data Science, Machine Learning, Programming, Technology.
'Hyderabad',{'distance':100}), ('Chennai', 'Jaipur',{'distance':1200})] WG.add_edges_from(city_graph) #extract labels for distance attribute we added above labels = nx.get_edge_attributes(WG, "distance") # Draw the graph pos = nx.spring_layout(WG) nx.draw(WG,pos,with_labels=True) # Draw edge labels