<｜begin▁of▁sentence｜>### Instruction:
Given the Network Science coauthorship graph which you can read from a GML file named netscience.gml, can you use the sbm_dl function in cdlib to perform community detection based on Stochastic Block Models by minimizing description length? And can you output the detected communities as a JSON object?
### Response:
import networkx as nx
from cdlib import algorithms

# Load a graph of coauthorships in network science
G = nx.read_gml('netscience.gml')

# Perform community detection using Stochastic Block Models via description length
communities = algorithms.sbm_dl(G)

# Output the detected communities as a JSON object
communities_json = communities.to_json()
print(communities_json)
<|EOT|>
