library('igraph')
g <- matrix(0,10,10)
g[1,] <- c(0, 0.3, 0.7, 0, 0, 0, 0, 0, 0, 0)
g[2,] <- c(0.1, 0, 0, 0.4, 0.5, 0, 0, 0, 0, 0)
g[3,] <- c(0.7, 0.3, 0, 0, 0, 0, 0, 0, 0, 0)
g[4,] <- c(0, 0, 0, 0, 0, 0.3, 0.3, 0.4, 0, 0)
g[5,] <- c(0, 0.2, 0.2, 0.2, 0, 0, 0, 0.4, 0, 0)
g[6,] <- c(0, 0, 0, 0, 0, 0, 0.3, 0.7, 0, 0)
g[7,] <- c(0.3, 0.1, 0, 0, 0, 0.5, 0, 0.1, 0, 0)
g[8,] <- c(0, 0, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.1)
g[9,] <- c(0, 0, 0, 0.2, 0, 0, 0.2, 0.4, 0, 0.2)
g[10,] <- c(0, 0, 0, 0.0, 0, 0, 0.2, 0.4, 0.4, 0)
plot(graph.adjacency(g>0),layout=layout.circle)
colors = c("red", "yellow", "blue", "green", "orange", "cyan", "hotpink", "green4", "coral", "azure")
barplot(t(g), legend=c('1','2','3','4','5','6','7','8','9','10'), col=colors)
barplot(t(g%*%g%*%g%*%g%*%g), legend=c('1','2','3','4','5','6','7','8','9','10'), col=colors)
image(g, col=topo.colors(100))
image(g%*%g%*%g%*%g%*%g, col=topo.colors(100))