tags:

views:

105

answers:

1

I would like to lay out graphs (trees) with two types of nodes: boxes and circles.

Is this possible with igraph and how would a minimal example look like?

+3  A: 
library(igraph)
g <- graph.empty()
g <- add.vertices(g, 4, 
    label=c('a', 'b', 'c', 'd'), 
    shape=c('rectangle', 'rectangle', 'circle', 'circle'))
g <- add.edges(g, c(1, 2, 2, 3))
plot(g)
xiechao
just for reference, I found out that "color" is one more attribute to add.vertices that sets the background color.
Karsten W.
And "size" seems to be another, however I did not find out how it works for rectangles.
Karsten W.