#Create an arbitrary adjacency matrix
m<-matrix(rbinom(25,1,0.5),5,5)
diag(m)<-0
g<-network.initialize(5) #Initialize the network
network.adjacency(m,g) #Import the edge data
#Do the same thing, using replacement operators
g<-network.initialize(5)
g[,]<-m
Run the code above in your browser using DataLab