grafik terarah python

Another library you could use is NetworkX. It provides a implementation 
of directed graphs that provide functions to get incomming 
edges DiGraph.in_edges() and outgoing edges DiGraph.out_edges() 
for arbitrary sets of nodes. Usage samples are provided in the 
linked documentation, but unfortunately I didn't see any details 
about efficiency or run time.
Awesomelewis_2007