<｜begin▁of▁sentence｜>### Instruction:
Given a graph with edge set [(0, 1), (0, 2), (1, 3), (2, 3), (2, 4)] and nodes assigned to types [0, 1, 0, 1, 1], can you use the modularity function in igraph to calculate the modularity of the graph with respect to the given node types?
### Response:
from igraph import Graph

# Create a graph
edges = [(0, 1), (0, 2), (1, 3), (2, 3), (2, 4)]
node_types = [0, 1, 0, 1, 1]
g = Graph(edges=edges)

# Calculate modularity
modularity_score = g.modularity(node_types)
print('Modularity:', modularity_score)
<|EOT|>
