[R] Howto modify a drawn graph with igraph
Etienne Cuvelier
etienne.cuvelier at ecp.fr
Sun Jun 6 17:58:14 CEST 2010
Hello,
I am using the igraph package, and I wonder how to add or modify
informations on a drawn graph.
Example:
library(igraph)
M <- matrix( nc=12, nr=12 , 0)
M[ 1,]=c(0,1,0,0,1,1,0,0,0,0,0,0)
M[ 2,]=c(1,0,1,1,1,0,0,0,0,0,0,0)
M[ 3,]=c(0,1,0,0,0,1,1,0,0,0,0,0)
M[ 4,]=c(0,1,0,0,0,1,0,0,0,0,0,0)
M[ 5,]=c(1,1,0,0,0,0,0,0,0,0,0,0)
M[ 6,]=c(1,0,1,1,0,0,0,0,0,0,0,0)
M[ 7,]=c(0,0,1,0,0,0,0,1,1,0,0,1)
M[ 8,]=c(0,0,0,0,0,0,1,0,1,0,0,1)
M[ 9,]=c(0,0,0,0,0,0,1,1,0,0,1,1)
M[10,]=c(0,0,0,0,0,0,0,0,0,0,1,0)
M[11,]=c(0,0,0,0,0,0,1,0,1,0,0,0)
M[12,]=c(0,0,0,0,0,0,0,1,1,0,0,0)
g <- graph.adjacency( M,mode="undirected" )
mlayout= layout.kamada.kawai(g)
plot(g,layout=mlayout)
#And now howto add a weight associated on edges on the "picture"?
#Or howto change the color of an edge, or a vertice?
Thanks for help.
Etienne
More information about the R-help
mailing list