I am making an animation using the igraph
and animation
packages. I want to watch the change in edges by animating through a data.frame 1 row at a time. I have create a list of igraph objects and would like to make sure all social actors are represented even if their row hasn't come up yet. They would become isolates until a later animation.
How can I add an actor into an igraph object as an isolate. I'm using a layout.circle
and want to keep the actors in a consistent placement.
I'll start with data (the igraph object) and then some visuals to show what I want.
g <- structure(list(4, TRUE, c(0, 1, 2, 0), c(1, 2, 0, 3), c(0, 3,
1, 2), c(2, 0, 1, 3), c(0, 2, 3, 4, 4), c(0, 1, 2, 3, 4), list(
c(1, 0, 1), structure(list(), .Names = character(0)), structure(list(
name = c("greg", "teacher", "sam", "sally"), size = c(10,
10, 10, 10)), .Names = c("name", "size")), structure(list(
wc = c(5L, 4L, 10L, 5L), id = 2:5, prop_wc = c(0.208333333333333,
0.166666666666667, 0.416666666666667, 0.208333333333333
), color = c("grey50", "grey50", "grey50", "grey50"),
width = c(3.125, 2.5, 6.25, 3.125)), .Names = c("wc",
"id", "prop_wc", "color", "width")))), class = "igraph")
library(igraph)
plot(g, layout=layout.circle)
## vector of actors to include in this order
## in the igraph object there is no "researcher" or "End" actor
actors <- c("greg", "teacher", "sam", "sally", "researcher", "End")
This plots as:
I would like (don't worry about the line width weightings):
So the animation sequence would be something like this (all actors are included at each frame):
If I can add the isolates c("researcher", "End")
to the igraph above I can generalize to each frame.
I thought it might be as easy as:
V(g) <- actors
but it is not.