<｜begin▁of▁sentence｜>### Instruction:
Given a randomly generated graph with 30 nodes and a connection probability of 0.05 for each edge pair, can you use the leiden function from graspologic to identify the community structure and then print out the community membership for each node?
### Response:
import networkx as nx
from graspologic.partition import leiden

# Generate a small random graph using networkx
G = nx.erdos_renyi_graph(n=30, p=0.05)

# Use the leiden algorithm to find the best partition of the graph
partition = leiden(graph=G)

# Display the community each node belongs to
for node, community in partition.items():
    print(f'Node: {node} -> Community: {community}')
<|EOT|>
