igraph-help
[Top][All Lists]

## Re: [igraph] timestep plotting

 From: Vincent Matossian Subject: Re: [igraph] timestep plotting Date: Mon, 8 Jan 2007 10:35:45 -0500

Hi Gabor,

thanks a lot, I hadn't thought of doing it this way at all, it's a neat idea! :)

when you say that with the current code it could be made more simple, do you mean using iterators over the set of nodes+edges and using color attributes at every step to add (instead of deleting all irrelevant) the newly added nodes and edges?

I really like the effect of this visualization, thanks again!

Vincent

On 1/8/07, Gabor Csardi < address@hidden> wrote:

Vincent,

here is an example, i used it to visualize a growing barabasi.game, might be
useful. The code is for an older version of igraph, it might still work.
With the current version it could be done in a much simpler way.

If you save the (say) PNG files, there are some programs which create a
video of these or an animated GIF, etc.

G.

###################################################

library(igraph)
g <- barabasi.game(100, directed=FALSE)

# use this for corrections
# id <- tkplot(g, layout=coords, vertex.size=3, label.dist=1)
# coords <- tkplot.getcoords(id)

el <- get.edgelist(g)
colors <- sample(3:6, vcount(g), replace=TRUE)
for (idx in seq(vcount(g))-1) {

el2 <- el[ el[,1] > idx | el[,2] > idx, ]
color <- colors
frame <- rep("black", vcount(g))
size <- rep(3, vcount(g))
if (idx+2 <= vcount(g)) {
color [(idx+2):vcount(g)] <- "white"
frame [(idx+2):vcount(g)] <- "white"
}
size  [idx+1] <- 6

g2 <- delete.edges(g, E(g, P=t(el2)))
filename <- paste(sep="", "pa-growth-", idx, ".fig")
# use this to save the images. (or png(), jpeg(), etc.)
#  xfig(file=filename, >  plot(g2, layout=coords, vertex.size=size, labels=NA, vertex.color=color,
vertex.frame.color=frame)
Sys.sleep (0.1)
#  dev.off()
}

###################################################

On Sat, Jan 06, 2007 at 10:51:02AM +0100, Gabor Csardi wrote:
> Vincent,
>
> there is no direct support for this. For some graphs it is easy as you
> know the order of the edges added. Eg. for barabasi.game outgoing edges from
> vertex j were added later than outgoing edges of vertex i if j>i.
>
> Each network generation function would need some change to support it. And
> also it is not very easy to implement it. The current graph data structure
> stores edges simply according to the order of their addition but this is not
> part of the specification so you cannot assume it. I'll think about it,
> please remind me in a week or so. :)
>
> Btw. for which functions do you need this?
>
> G.
>

--
Csardi Gabor <address@hidden >    MTA RMKI, ELTE TTK

_______________________________________________
igraph-help mailing list