library(igraph)
g <- make_star(5, "undirected")
majorization_gap(g) # 0 since star graphs are threshold graphs
g <- sample_gnp(100, 0.15)
majorization_gap(g, norm = TRUE) # fraction of reverse unit transformation
majorization_gap(g, norm = FALSE) # number of reverse unit transformation
Run the code above in your browser using DataLab