<｜begin▁of▁sentence｜>### Instruction:
As a Database Administrator, you're tasked with overseeing the database infrastructure to guarantee data integrity, security, and availability. Suppose you're working with a social media platform where users belong to different communities based on their interests. Each community is represented by a group of users connected through interactions.

Now, imagine you're asked to analyze the platform's user interactions graph to evaluate the strength of community structures. You have access to the NetworkX library, which allows you to model and analyze complex networks. Specifically, you're interested in using the `igraph.Graph.modularity` function to quantify the modularity of the graph concerning these predefined communities.

In this scenario, you're essentially looking to leverage the modularity function to assess how well-defined and distinct these user communities are within the network, aiding in optimizing community-based features and enhancing user experience.
### Response:
from igraph import Graph

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

# Assume a community structure as: community 1 = {0, 1, 2, 3}, community 2 = {4, 5, 6, 7}
membership = [0, 0, 0, 0, 1, 1, 1, 1]

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