Graph to Matrix coersions {graph} | R Documentation |
Functions for converting graph objects into matrices
A graphNEL
can be directly coerced into a adjacency
matrix
using the as
method. If the graph is undirected
then the
matrix will by symmetric.
An adjacency
For aM2bpG
, an object of class graphNEL
. For
ftM2adjM
, an adjacency matrix representation of the coerced graph.
Byron Ellis
From <- matrix(sample(c(0,1),16,replace=TRUE),ncol=4,nrow=4) dimnames(From) <- list(LETTERS[1:4],LETTERS[1:4]) To <- as(From,"graphNEL") Back <- as(To,"matrix") if(sum(From == Back) != 16) warning("conversion failed")