library(igraph)
## Example with known maximum cut
K10 <- make_full_graph(10) # Max cut of size 25
c0 <- build_cut_greedy(K10)
c0$size # 25
plot_cut(c0, K10)
## Max-cut of a random graph
set.seed(1)
n <- 25
g <- sample_gnp(n, p=0.25)
c2 <- build_cut_greedy(g)
c2$size # 59
plot_cut(c2, g)
Run the code above in your browser using DataLab