EncodeDirectedGraph {GraphAlignment} | R Documentation |
Encode an adjacency matrix for a directed graph into a symmetric matrix.
EncodeDirectedGraph(matrix, P)
matrix |
square matrix |
P |
permutation vector |
The result is obtained by setting entries (i, j) and (j, i) of the target matrix m' to 1 if entry m[i, j] = 1 and P[i] > P[j] and to -1 if m[i, j] = 1 and P[j] > P[i].
The return value is a symmetric matrix representing the encoded input matrix.
dg <- matrix(c(0, 1, 0, 0, 1, 1, 1, 0, 1), 3, 3) EncodeDirectedGraph(dg, 1:dim(dg)[1])