<｜begin▁of▁sentence｜>### Instruction:
As a restaurant owner, you may be interested in optimizing your seating arrangements to encourage social interactions among your patrons. By using network analysis, you can model the connections between tables and identify the optimal community structure within your restaurant. Given the arrangement of tables and the connections between them (represented as a graph), along with the "weights" representing the strength of the connections, you can utilize the 'community_optimal_modularity' function from the igraph API to determine the best community structure that maximizes the social interactions and overall customer experience.
### Response:
import igraph as ig

# Create a graph with an edge attribute named 'weight'
edges = [(0, 1), (1, 2), (2, 3), (3, 4), (0, 4), (0, 2)]
weights = [1,2,1,2,1,2]
g = ig.Graph(edges=edges)
g.es['weight'] = weights

# Calculate the optimal modularity and corresponding community structure
membership, modularity = g.community_optimal_modularity(weights='weight')

# Print the membership vector and modularity
print('Membership vector:', membership)
print('Modularity:', modularity)
<|EOT|>
