<｜begin▁of▁sentence｜>### Instruction:
As a networkX assistant, I can assist you in converting a community structure within a graph into a membership vector format. You can provide the graph by reading it from a GML file named community_graph.gml, where the community structure is stored in a vertex attribute called 'community_structure'. I can help you use the community_to_membership function available in the igraph package to achieve this conversion.
### Response:
import igraph as ig

# Assuming we have loaded a graph 'graph' with community structure metadata
g = ig.read('community_graph.gml')

# Assuming the graph 'g' has a community structure in a variable called 'community_structure'
communities = g.vs['community_structure']

# Prepare a membership list
membership = ig.community_to_membership(g, communities)

print('Membership vector:', membership)
<|EOT|>
