<｜begin▁of▁sentence｜>### Instruction:
Assuming we have a directed graph with the following edges: [(1, 2), (2, 3), (3, 4), (4, 1)], where each vertex connects to the next, forming a cycle, can the is_regular function be used to determine if this graph is a regular graph? Each node in this graph has an indegree and outdegree of 1.
### Response:
import networkx as nx

# Create a directed graph
G = nx.DiGraph([(1, 2), (2, 3), (3, 4), (4, 1)])

# Use the is_regular function to determine if the graph is a regular graph
is_reg = nx.is_regular(G)

# Print the result
print('Is the directed graph regular?', is_reg)
<|EOT|>
