> 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 "layout" graph attribute that you assign your layout to is "just" an ordinary graph attribute; in other words, igraph does not "know" that the value of the layout attribute is a matrix whose rows refer to the vertices. Since igraph does not know this, it won't adjust the layout attribute when you construct the induced subgraph. (The adjusted layout would not include the rows corresponding to the vertices that are not in the induced subgraph). As you guessed already, the easiest way to make it work is to assign the x/y coordinates separately as vertex attributes. Alternatively, you can keep the layout object independent of the graph and subset it when plotting:
layout <- layout.fruchterman.reingold(g) plot(g, layout=layout) vertices <- which(cl$membership == which.max(cl$csize)) g1 <- induced.subgraph(g, vertices) plot(g1, layout=layout[vertices,]) Cheers, Tamas _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
