<｜begin▁of▁sentence｜>### Instruction:
Can you apply the DrL layout algorithm using igraph to visualize the placement of vertices for a randomly generated Erdős-Rényi graph with 10 vertices and 20 edges, and save the 2D coordinates to a JSON file?
### Response:
from igraph import Graph
import json

# Create an example graph
g = Graph.Erdos_Renyi(n=10, m=20)

# Apply the DrL layout algorithm
drl_layout = g.layout_drl()

# Convert the layout to a list of coordinates
layout_coords = drl_layout.coords

# Save the layout coordinates to a JSON file with a custom function
def save_layout_to_json(layout, filename):
    with open(filename, 'w') as f:
        json.dump(layout, f)

# Usage
save_layout_to_json(layout_coords, 'graph_layout.json')
<|EOT|>
