networkx

import networkx as nx
g = nx.DiGraph()
g.add_edges_from([(1,2), (3,4)])