Graph to Matrix coersions {graph}R Documentation

Coercing matrices to graphs

Description

Functions for converting graph objects into matrices

Details

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.

Value

An adjacency For aM2bpG, an object of class graphNEL. For ftM2adjM, an adjacency matrix representation of the coerced graph.

Author(s)

Byron Ellis

Examples


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")


[Package Contents]