# NOT RUN {
## Zachary's karate club
g <- make_graph("Zachary")
## We put everything into a big 'try' block, in case
## igraph was compiled without GLPK support
try({
## The calculation only takes a couple of seconds
oc <- cluster_optimal(g)
## Double check the result
print(modularity(oc))
print(modularity(g, membership(oc)))
## Compare to the greedy optimizer
fc <- cluster_fast_greedy(g)
print(modularity(fc))
}, silent=TRUE)
# }
Run the code above in your browser using DataLab