[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Problem with layouts with GraphML
From: |
Tamas Nepusz |
Subject: |
Re: [igraph] Problem with layouts with GraphML |
Date: |
Thu, 19 Nov 2009 17:57:34 +0000 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hi Karl,
> My problem is that if I open the resulting .graphml files with
> yEd (by yWorks), all the vertices are centered and it is impossible to
> see the graph.
This is because no layout information is saved in the GraphML file when
you export a graph from igraph. If you want to calculate a layout in
igraph and then store it in the GraphML file, you will need two things:
1. Attach the (experimental) C attribute handler to igraph; these set
of functions are responsible for storing attributes properly in the
C layer. (The R and the Python interfaces use different attribute
handlers, that's why you have to attach the attribute handler
manually). See: http://igraph.sourceforge.net/doc/html/ch09s02.html
2. Calculate a layout using some of the layout functions in igraph
and save the layout in an igraph_matrix_t.
3. Extract the first and the second column of the matrix to two
igraph_vector_t variables.
4. Copy the calculated coordinates from the vectors to two node
attributes (say, X and Y) using igraph_cattribute_VAN_setv or its
associated macro version called SETVANV.
5. Save your graph into GraphML as you did before.
If you do this, the saved GraphML file will contain the calculated
layout information using the two node attributes. However, I don't know
whether yEd can be "convinced" to use these attributes for setting up
the layout in the graph view. When you save a graph from yEd into
GraphML format, yEd uses its own XML schema extensions to store the
layout and other visual properties of nodes and edges, and you cannot
reproduce that from igraph.
--
Tamas