'Colouring edge of network based on their direction - NetworkX

In R ggplot2, there is a simple way to color the edge of a network based on its direction between nodes. So if a line (edge) is directed from the nodes A to B, we can use the code:

geom_edge(aes(colour=stat(index))

Then I tried to redo this in python using NetworkX - to no avail. Here is an example network:

F.add_nodes_from([0,1])
F.add_nodes_from([0,2])
F.add_nodes_from([2,1])
post = nx.circular_layout(F)
nx.draw_networkx_nodes(F, post, node_color = 'r', node_size = 100, alpha = 1)
nx.draw_networkx_edges(F, post, edgelist= [(1,0)], width = 1, alpha = 1)
nx.draw_networkx_edges(F, post, edgelist= [(0,2)], width = 1, alpha = 1)
nx.draw_networkx_edges(F, post, edgelist= [(2,1)], width = 1, alpha = 1)
plt.axis('off')
plt.show()

And I have so far found no way to change the colour according to the direction of the edge. Ideally, I would like to achieve something like this:

Please see photo here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source