<｜begin▁of▁sentence｜>### Instruction:
A network analyst is working with a social network graph of 100 individuals, represented by an undirected graph. The individuals are divided into 5 communities. The analyst is interested in measuring the strength of the division of these communities. The network is generated using the Erdős-Rényi model with a connection probability of 0.1. To assess the community structure, they aim to compute the modularity score of this partitioning. How can `graspologic.partition.modularity` be used to calculate the modularity of the graph given a dictionary mapping each vertex to a community id?
### Response:
import networkx as nx
from graspologic.partition import modularity

# Generate a synthetic network graph
G = nx.erdos_renyi_graph(n=100, p=0.1)

# Assign community labels to each node
community_labels = {node: node % 5 for node in G.nodes()}

# Compute the modularity of the graph with the given community partitioning
modularity_score = modularity(graph=G, partitions=community_labels, weight_attribute='weight', resolution=1.0)

print('Modularity:', modularity_score)
<|EOT|>
