igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] plotting graphs with edges of various length


From: Gábor Csárdi
Subject: Re: [igraph] plotting graphs with edges of various length
Date: Sun, 9 Mar 2014 19:01:09 -0400

I am not sure why you think the "length" edge attribute is used for anything. It is not, AFAIK.

G.


On Sun, Mar 9, 2014 at 6:05 PM, aschmid1 <address@hidden> wrote:
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 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.

_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help


reply via email to

[Prev in Thread] Current Thread [Next in Thread]