g1 <- graph.empty()
g2 <- graph( c(1,2,2,3,3,4,5,6), directed=FALSE )
adjm <- matrix(sample(0:1, 100, replace=TRUE, prob=c(0.9,0.1)), nc=10)
g3 <- graph.adjacency( adjm )
g4 <- graph.star(10, mode="out")
g5 <- graph.lattice(c(5,5,5))
g6 <- graph.lattice(length=5, dim=3)
g7 <- graph.ring(10)
g8 <- graph.tree(10, 2)
g9 <- graph.full(5, loops=TRUE)
Run the code above in your browser using DataCamp Workspace