Hello all,
I'm trying to plot subsets of a large graph with the layout from the full graph 
retained. In trying to make use of the induced.subgraph command to do so, it's 
not carrying over layout information in the way I'd expect, and throws an 
error. This is because the resulting subgraph's layout is still the same size 
as the initial graph despite the induced subgraph being described as the proper 
reduced size (see below). (For what it's worth, i got similar results using 
delete.vertices and decompose.graph.) The only way I can get it to work is if I 
assign the x/y coordinates separately as Vertex attributes. Am I missing 
something obvious here? 

Thanks!
jimi


(I'm using igraph 0.6.5-2 on R 3.0.1)
g <- graph.empty(n=10)
g <- add.edges(g, c(1,2, 2,3, 3,4, 4,5, 5,6, 6,7, 7,8, 8,9))
g$layout <- layout.fruchterman.reingold(g)
cl <- clusters(g)
g1 <- induced.subgraph(g, which(cl$membership == which.max(cl$csize)))
plot(g1)

Warning messages:
1: In layout[, 1] + label.dist * cos(-label.degree) * (vertex.size +  :
  longer object length is not a multiple of shorter object length
2: In layout[, 2] + label.dist * sin(-label.degree) * (vertex.size +  :
  longer object length is not a multiple of shorter object length

g1$layout
           [,1]        [,2]
 [1,]  7.736875  -0.6740434
 [2,] 10.501357  -1.9003011
 [3,] 12.884866  -4.1480289
 [4,] 13.809373  -7.3576897
 [5,] 12.706605 -10.5351037
 [6,]  9.945241 -12.4542989
 [7,]  6.604280 -12.4398371
 [8,]  3.793292 -10.7592216
 [9,]  1.866786  -8.4273313
[10,]  2.525595  -2.8272703

g1
IGRAPH D--- 9 8 -- 
+ attr: layout (g/n)

jimi adams
Assistant Professor
Department of Sociology
American University
e: [email protected]
w: jimiadams.com


_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to