[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] igraph Graph Attribute
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] igraph Graph Attribute |
Date: |
Wed, 3 Aug 2011 20:02:21 +0200 |
Hi,
Saving a layout object in a GraphML file is not supported; you can only save
numeric and string attributes in GraphML. You can do two things:
1. Store the layout as two vertex attributes: x and y. Since each attribute
value would then only be a single number, igraph would be able to save it.
2. Save the graph in R's own native format using the "save" function. This
would preserve all associated attributes, no matter what their types is.
Also note that instead of set.graph.attribute, you can use the following to
attach the layout to the graph:
g$layout <- layout.fruchterman.reingold(g)
In general, the $ syntax is preferred since it is easier to read. Similarly,
you can use V(g)$... to attach vertex attributes and E(g)$ to attach edge
attributes.
Cheers,
Tamas
On 3 Aug 2011, at 17:40, Nick Rolando wrote:
> Dear All,
>
> I generated a graph attribute with a layout using
> g<- set.graph.attribute(g, "layout", layout.fruchterman.reingold(g)) and it
> worked great but when trying to save the whole graph the layout seems to be
> always omitted. When reading the graph and then trying to plot it I get
> Error in layout.norm(layout, -1, 1, -1, 1) : `layout' not a matrix
> and while looking into a file there is only one line that correspond to graph
> attribute
> <graph id="G" edgedefault="undirected">
> <data key="layout">-435.619</data>
> I have read tried many formats but none of them work. Any idea what is wrong?
> Is it not possible to save the graph attributes? (I need to re plot it with
> different values many times so this would be very useful). Is there an
> alternative to save this layout to a file so I can use it with the graph
> later?
>
> Thank you,
> Nick
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help