|
From: | Gábor Csárdi |
Subject: | Re: [igraph] plotting graphs with edges of various length |
Date: | Sun, 9 Mar 2014 19:01:09 -0400 |
Tamas,
Thank you. I suspected I wanted too much from igraph. Indeed one cannot draw say a triangle with arbitrary edge lengths... But then I have a naive question (I'm new to graphs): how the edge attribute "length" may be used (providing there is also attribute "weight")?
Best, Alec
On 03/09/2014 3:32 PM, Tamás Nepusz wrote:
I thought that the commandsNo, it doesn’t. *Some* layout algorithms *might* take into account the
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.
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.
_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help
[Prev in Thread] | Current Thread | [Next in Thread] |