<｜begin▁of▁sentence｜>### Instruction:
Suppose we have a network graph created using a stochastic block model with three communities, and we want to apply the hierarchical leiden algorithm to detect communities at various resolutions. How can we obtain the initial and final level of hierarchical clustering results using the `HierarchicalClusters` from `graspologic.partition`?
### Response:
import numpy as np
import networkx as nx
from graspologic.simulations import sbm
from graspologic.partition import HierarchicalCluster, hierarchical_leiden

# Simulate a stochastic block model graph
n_communities = [50, 50, 50]
p_block = [[0.5, 0.05, 0.02],
            [0.05, 0.5, 0.07],
            [0.02, 0.07, 0.5]]
G = nx.Graph(sbm(n_communities, p_block))

# Apply hierarchical leiden algorithm on the graph
hierarchical_clusters = hierarchical_leiden(G)

# Get the first and final level of hierarchical clustering
first_level = hierarchical_clusters.first_level_hierarchical_clustering()
final_level = hierarchical_clusters.final_level_hierarchical_clustering()

# Output the first and final level of clustering
print('First level hierarchical clustering:')
print(first_level)
print('\nFinal level hierarchical clustering:')
print(final_level)
<|EOT|>
