[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Some peculiarities
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] Some peculiarities |
Date: |
Thu, 19 Jun 2014 14:11:09 +0200 |
Hello,
> p <- function(y) {
> g <- graph.adjacency(y, mode = "directed");
> plot(g, layout = layout.spring);
> }
> [...]
> p(x);
> p(x); # Output differs.
>
> Why does the output differ between the last two calls to p()?
layout.spring starts from a random configuration and then iterates for a given
number of iterations, so it is not guaranteed to give the same layout every
time. Consider using layout.fruchterman.reingold or layout.kamada.kawai -- they
are based on similar principles but allow you to specify a starting
configuration (use the "start" parameter), so the layout will be the same if
you use the same starting configuration.
> Second, I wonder whether there is a simple explanation why triad.census()
> may return negative values for empty subgraphs?
You are right, this is an integer overflow. You can get the correct value by
subtracting the other values in the result vector from the number of all
possible triads in the graph.
- T.