<｜begin▁of▁sentence｜>### Instruction:
Given a directed graph with an edge set [(1, 2), (2, 3), (3, 1), (3, 4), (4, 1), (4, 2)], how to generate all possible triads (order-3 directed subgraphs) using NetworkX?
### Response:
import networkx as nx

# Create a directed graph
G = nx.DiGraph()

# Add edges
e = [(1, 2), (2, 3), (3, 1), (3, 4), (4, 1), (4, 2)]
G.add_edges_from(e)

# Generate all triads
triads = [triad.edges() for triad in nx.all_triads(G)]

# Print all the triads
for triad in triads:
    print(triad)
<|EOT|>
