I'm having a matrix like the following one
m <- expand.grid(LETTERS[1:24],LETTERS[1:24])
m$weight <- runif(nrow(m), 0.01, max = 1)
m <- m[m$Var1!=m$Var2, ] ##remove loop edges
colnames(m) = c("to","from","weight")
and in this form it describes a directed graph. What I want to do is to subtract and take the absolute value of each pair of inverse edges and create a new matrix describing a new undirected graph. i.e:
abs( edge_weight(A,B) - edge_weight(B,A) )
But I don't know how to take into account only once each pair.