I'm programming a basic neural network and want to plot it as a picture. For that, I created all the nodes and edges I need.
for l, j in zip(self.layers, range(len(self.layers))):
for n, i in zip(l.neurons, range(len(l.neurons))):
fixed_positions[n.identifier] = (j, i)
for l in self.layers:
for n in l.neurons:
for c, w in zip(n.inconnections, n.inconnectionweights):
g.add_edge(n.identifier, c.identifier)
fixed_nodes = fixed_positions.keys()
pos = nx.spring_layout(g, pos=fixed_positions, fixed=fixed_nodes)
the blue points (imagine them on all edges) are where I want to add a label onto the edges, but I don't know how to do it. It's supposed to work for any reasonable net size, i.e. it should also work for 4, 3 and 2 neurons in the respective layers.



