<｜begin▁of▁sentence｜>### Instruction:
Given a directed graph with nodes 1, 2, 3, and 4 and directed edges from 1 to 2, from 2 to 3, and from 3 to 4, can you find all possible sets of 3 nodes in this graph?
### Response:
import networkx as nx

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

# Add edges to the graph
G.add_edges_from([(1, 2), (2, 3), (3, 4)])

# Use the all_triplets function to find all possible triplets of nodes
triplets = list(nx.all_triplets(G))
print(triplets)
<|EOT|>
