<｜begin▁of▁sentence｜>### Instruction:
Given a simple undirected graph with edges defined by the pair list [(0, 1), (0, 2), (1, 2), (2, 3)], how can you use the igraph library along with Cairo to draw the graph and output it to an image file named 'graph.png'?
### Response:
import igraph as ig
import cairo

# Initialize the graph
edges = [(0, 1), (0, 2), (1, 2), (2, 3)]
g = ig.Graph(edges=edges)

# Create a Cairo image surface to draw to
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 400, 400)
ctx = cairo.Context(surface)

# Initialize a CairoGraphDrawer object
drawer = ig.CairoGraphDrawer(ctx)

# Draw the graph onto the Cairo context
# Note: The layout is calculated automatically if not provided.
drawer.draw(g)

# Save the drawn graph to a file
surface.write_to_png('graph.png')
<|EOT|>
