3

I'm trying to set a fill color in Rgraphviz for a subgraph. In the documentation, it is implied that you can set subgraph attributes where you set whether or not the subgraph is a cluster, like so:

subGList = list()
subGList[[1]] = list(graph=sg.iip, attrs=c(fillcolor="lightgreen", style = "filled", 
  shape = "rectangle"), cluster = TRUE)

Unfortunately, setting attributes in this manner doesn't seem to have any effect on the plot.

Because my subgraphs contain 20-30 nodes (where the full graph has 250 nodes), it's not really reasonable to code it with the nodewise method where you have to use each node name and set it to the color.

edit My current workaround is to do:

vc <- as.list(rep("lightgreen", length(subgraphNames)))
names(vc) <- subgraphNames

plot(fG.iip.NEL, 'neato', subGList=subGList, nodeAttrs = list(fillcolor=vc))
Jenny Yang
  • 31
  • 2
  • Can you add a small graph please: note this can only have a few nodes. thanks – user20650 Jul 18 '17 at 20:15
  • Sorry I'm not sure what you mean. I usually create graphs using igraph's ability to transform adjacency matrices into graphNEL objects like so: ex = matrix(c(0,0,0,0,1,1,0,0,1), ncol = 3); exNEL = as(ex, "graphNEL") – Jenny Yang Jul 18 '17 at 20:17

0 Answers0