Simulations

library(igraph)
library(expm)

A <- function(g, attr=NULL) {
  as_adjacency_matrix(g, attr=attr, sparse=FALSE)
}
Unbal <- function(A) {
  sum(diag(abs(A) %^% 3 - A %^% 3))/12
}
Embed <- function(A) {
  abA <- abs(A)
  abA * abA %^% 2
}
Permute <- function(g) {
  
}
n <- 30 # number of vertices
m <- 30 # number of edges
r <- 5 # number of negative edges
# generate a graph with n vertices and m edges
g <- sample_(gnm(n, m))
X <- A(g)

# generate the signs
q <- r/(r+m) # ratio of negative to positive
neg <- sample_(gnp(n, q))
Y <- A(neg)