"""
==========
Self-loops
==========
A self-loop is an edge that originates from and terminates the same node.
This example shows how to draw self-loops with `nx_pylab`.
"""
import networkx as nx
import matplotlib.pyplot as plt
G = nx.complete_graph(3, create_using=nx.DiGraph)
G.add_edge(0, 0)
pos = nx.circular_layout(G)
nx.draw(G, pos, with_labels=True)
edgelist = [(1, 1), (2, 2)]
G.add_edges_from(edgelist)
nx.draw_networkx_edges(G, pos, edgelist=edgelist, arrowstyle="<|-", style="dashed")
plt.show()