<｜begin▁of▁sentence｜>### Instruction:
Given the High-energy theory collaborations graph read from a GML file named hep-th.gml, how can you use the 'leiden' function in cdlib to perform community detection, and how can you display the detected communities?
### Response:
import networkx as nx
from cdlib import algorithms

# Load the high-energy theory collaborations graph
G = nx.read_gml('hep-th.gml')

# Apply the Leiden community detection algorithm
communities = algorithms.leiden(G)

# Print the communities
for community in communities.communities:
    print(community)
<|EOT|>
