[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] plotting graphs with edges of various length
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] plotting graphs with edges of various length |
Date: |
Sun, 9 Mar 2014 20:32:15 +0100 |
> I thought that the commands
> gm<-set.edge.attribute(gm, "weight", index=E(gm), value=weights)
> gm<-set.edge.attribute(gm, "length", index=E(gm), value=weights)
> ensure that plot(gm) yields the edge lengths corresponding to the values
> of vector weights.
No, it doesn’t. *Some* layout algorithms *might* take into account the weights
of the edges to *some* extent (i.e. they would *try* to ensure that edges with
larger weights end up being shorter than edges with smaller weights), but there
is no layout algorithm that would guarantee that the lengths you specify are
satisfied exactly. The main reason is that most of the length combinations are
impossible to satisfy in the 2D plane; for instance, it is impossible to plot a
full graph of size 4 if we want every single edge to be of length 1 (and there
are infinitely many examples for this).
As far as I know, the Fruchterman-Reingold layout algorithm (see
layout.fruchterman.reingold) is the only one in igraph that supports weights;
see http://igraph.sourceforge.net/doc/R/layout.html . But even for the
Fruchterman-Reingold algorithm, the only thing that the weights do is that they
make the attraction forces between the endpoints of the edges proportional to
the weight of the edge.
—
T.