library(igraph)
## Example with known maximum cut
K10 <- make_full_graph(10) # Max cut of size 25
c0 <- build_cut_random(K10)
c0$size # Different results: 24, 21, ...
plot_cut(c0, K10)
## Max-cut of a random graph
set.seed(1)
n <- 25
g <- sample_gnp(n, p=0.25)
c1 <- build_cut_random(g) # Repeat as you like
c1$size # Different results: 43, 34, 39, 46, 44, 48...
plot_cut(c1, g)
Run the code above in your browser using DataLab