import sys, os sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))) import networkx as nx import matplotlib.pyplot as plt g = nx.Graph() g.add_node('a') g.add_node('b') g.add_node('c') g.add_node('d') g.add_edge('a', 'b') g.add_edge('b','c') g.add_edge('b','d') posx = nx.spring_layout(g) print(posx) for n in posx: print(n) nx.draw(g, posx) plt.show()