#Create a random network
m <- matrix(rbinom(25,1,0.5),5,5)
diag(m) <- 0
g <- network(m)
#Coerce to matrix form
as.matrix.network(g,matrix.type="adjacency")
as.matrix.network(g,matrix.type="incidence")
as.matrix.network(g,matrix.type="edgelist")
#Can also use the extraction operator
g[,] #Get entire adjacency matrix
g[1:5,6:10] #Obtain a submatrix
Run the code above in your browser using DataLab