I am using SPYDER. I have below code. The code produces the graph. But the graph is not clean. I would like to see layers in the graph - my first layer has 'start' node, second layer has 1,2,3 node, third layer has 'a', 'b', 'c' nodes and the last layer has 'end' node. Any idea how could i achieve my objective?
import networkx as nx
import matplotlib.pyplot as plt
import os.path as path
G=nx.DiGraph()
G.add_nodes_from(['start',1,2,3,'a','b','c','end'])
G.nodes(data=True)
G.add_edge('start',2)
G.add_edge('start',3)
G.add_edge(2,'b')
G.add_edge('b','end')
G.add_edge('a','end')
G.add_edge('f','g')
nx.draw(G)
------------------------update------------------
by layer i mean I should see the network like in the attached figure. I want the network drawn that way because a node in layer X will be connected directly ONLY to nodes in layer X+1 or layer X-1