Discussion:
[igraph] Problem with layouts with GraphML
Dr Karl
2009-11-19 17:03:55 UTC
Permalink
Hello all,

I'm a newbie with the iGraph library. I'm using the C version
of the library to generate some graphs with data from a database. I
have successfully generated graphs and written them in .graphml
format. If I open the resulting .graphml with a text editor it has all
the vertices and edges correctly in place. I am using yFiles Flex (by
yWorks) to nicely show the graphs in a Web Application (some Servlets
and Java business logic), this part of the project is already
completed.

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. If I select a Layout from the menus, yEd automatically
rearranges the vertices so that the graph can be seen.

So, I'm trying to pre-calculate a layout with iGraph before
writing to .graphml, but after reading the documentation and studying
the examples I'm unable to devise how to do it.

My problem is that the functions I have found for layout
calculation, like igraph_layout_random or igraph_layout_circle put the
resulting layout in a igraph_matrix_t, and I don't know how to include
this when I generate the graphml, as the function to write graphml
only accepts igraph_t as input.

Any help on this subject would be very much appreciated. Thank you
very much in advance.
Tamas Nepusz
2009-11-19 17:57:34 UTC
Permalink
Hi Karl,
Post by Dr 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
Dr Karl
2009-11-20 08:51:23 UTC
Permalink
Hi Tamas,

Thank you for your quick answer!!

Well, I have done what you said in your message, and now
my .graphml file has two attributes. This is my code, in case someone
needs to add attributes as well:

igraph_t g;
igraph_matrix_t res;
igraph_vector_t edges;
igraph_vector_t col1;
igraph_vector_t col2;
igraph_i_set_attribute_table(&igraph_cattribute_table);
igraph_vector_init(&edges, 4*relations.size());
igraph_matrix_init(&res, 0, 0);
int i = 0;
for (vector<Relationship>::iterator it = relations.begin(); it!
=relations.end(); ++it) {
rel = (Relationship)*it;
if (rel.AtoB>=1 && rel.BtoA>=1 && (rel.AtoB+rel.BtoA)>=minLevels) {
if (rel.AtoB>0 || rel.BtoA>0) {
VECTOR(edges)[i] = rel.nodeA;
i++;
VECTOR(edges)[i] = rel.nodeB;
i++;
}
}
}
igraph_vector_resize(&edges, i);
igraph_create(&g, &edges, 0, IGRAPH_DIRECTED);
igraph_layout_random(&g, &res);
long size = igraph_matrix_nrow(&res);
igraph_vector_init(&col1, size);
igraph_vector_init(&col2, size);
igraph_matrix_get_col(&res, &col1, 0);
igraph_matrix_get_col(&res, &col2, 1);
igraph_cattribute_VAN_setv(&g, "X", &col1);
igraph_cattribute_VAN_setv(&g, "Y", &col2);
FILE* graphml_file;
graphml_file = fopen("test_graph_layouts_random.graphml","w");
igraph_write_graph_graphml(&g, graphml_file);
igraph_vector_destroy(&edges);
igraph_vector_destroy(&col1);
igraph_vector_destroy(&col2);
igraph_destroy(&g);
igraph_matrix_destroy(&res);

Ok, now on every node I have two attributes, like this

<node id="n0">
<data key="X">-0.378323</data>
<data key="Y">0.89578</data>
</node>

but on yEd generated graphs, the layout is set like this

<node id="n0">
<data key="d0"/>
<data key="d1">
<y:ShapeNode>
<y:Geometry height="30.0" width="30.0" x="25.0" y="0.0"/>
<y:Fill color="#CCCCFF" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content"
fontFamily="Dialog" fontSize="12" fontStyle="plain"
hasBackgroundColor="false" hasLineColor="false" height="4.0"
modelName="internal" modelPosition="c" textColor="#000000"
visible="true" width="4.0" x="13.0" y="13.0"/>
<y:Shape type="rectangle"/>
</y:ShapeNode>
</data>
</node>

and before the <graph ...> tag

<key attr.name="description" attr.type="string" for="node" id="d0"/>
<key for="node" id="d1" yfiles.type="nodegraphics"/>
<key attr.name="description" attr.type="string" for="edge" id="d2"/>
<key for="edge" id="d3" yfiles.type="edgegraphics"/>
<key for="graphml" id="d4" yfiles.type="resources"/>

I only use yEd for quick viewing of the graph, but I assume that if a
graph doesn't display correctly on yEd, it won't display correctly on
my Flex web application based on yFiles either.

So, is there a way I can attach something like <y:Geometry
height="30.0" width="30.0" x="25.0" y="0.0"/> inside the <data
key="d1"> attribute?? this is like nested attributes, whick I don't
know if are supported by iGraph.

Thank you very much.
Post by Tamas Nepusz
Hi Karl,
Post by Dr 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
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
_______________________________________________
igraph-help mailing list
Dr Karl
2009-11-20 09:05:19 UTC
Permalink
Well, I think it may be easier to store the layout like this and later
make a post-processing of the XML to write the layout information with
the needed format. In fact I already have written a class in java to
insert custom data on every node, which I can re-use here to take the
values of the layout calculated by iGraph and set them in the format
that uses yFiles.

I'll try this approach and let you know what I did finally.

Best regards
Post by Dr Karl
Hi Tamas,
     Thank you for your quick answer!!
     Well, I have done what you said in your message, and now
my .graphml file has two attributes. This is my code, in case someone
        igraph_t g;
        igraph_matrix_t res;
        igraph_vector_t edges;
        igraph_vector_t col1;
        igraph_vector_t col2;
        igraph_i_set_attribute_table(&igraph_cattribute_table);
        igraph_vector_init(&edges, 4*relations.size());
        igraph_matrix_init(&res, 0, 0);
        int i = 0;
        for (vector<Relationship>::iterator it = relations.begin(); it!
=relations.end(); ++it) {
                rel = (Relationship)*it;
                if (rel.AtoB>=1 && rel.BtoA>=1 && (rel.AtoB+rel.BtoA)>=minLevels) {
                        if (rel.AtoB>0 || rel.BtoA>0) {
                                VECTOR(edges)[i] = rel.nodeA;
                                i++;
                                VECTOR(edges)[i] = rel.nodeB;
                                i++;
                        }
                }
        }
        igraph_vector_resize(&edges, i);
        igraph_create(&g, &edges, 0, IGRAPH_DIRECTED);
        igraph_layout_random(&g, &res);
        long size = igraph_matrix_nrow(&res);
        igraph_vector_init(&col1, size);
        igraph_vector_init(&col2, size);
        igraph_matrix_get_col(&res, &col1, 0);
        igraph_matrix_get_col(&res, &col2, 1);
        igraph_cattribute_VAN_setv(&g, "X", &col1);
        igraph_cattribute_VAN_setv(&g, "Y", &col2);
        FILE* graphml_file;
        graphml_file = fopen("test_graph_layouts_random.graphml","w");
        igraph_write_graph_graphml(&g, graphml_file);
        igraph_vector_destroy(&edges);
        igraph_vector_destroy(&col1);
        igraph_vector_destroy(&col2);
        igraph_destroy(&g);
        igraph_matrix_destroy(&res);
Ok, now on every node I have two attributes, like this
   <node id="n0">
      <data key="X">-0.378323</data>
      <data key="Y">0.89578</data>
    </node>
but on yEd generated graphs, the layout is set like this
   <node id="n0">
      <data key="d0"/>
      <data key="d1">
        <y:ShapeNode>
          <y:Geometry height="30.0" width="30.0" x="25.0" y="0.0"/>
          <y:Fill color="#CCCCFF" transparent="false"/>
          <y:BorderStyle color="#000000" type="line" width="1.0"/>
          <y:NodeLabel alignment="center" autoSizePolicy="content"
fontFamily="Dialog" fontSize="12" fontStyle="plain"
hasBackgroundColor="false" hasLineColor="false" height="4.0"
modelName="internal" modelPosition="c" textColor="#000000"
visible="true" width="4.0" x="13.0" y="13.0"/>
          <y:Shape type="rectangle"/>
        </y:ShapeNode>
      </data>
    </node>
and before the <graph ...> tag
  <key attr.name="description" attr.type="string" for="node" id="d0"/>
  <key for="node" id="d1" yfiles.type="nodegraphics"/>
  <key attr.name="description" attr.type="string" for="edge" id="d2"/>
  <key for="edge" id="d3" yfiles.type="edgegraphics"/>
  <key for="graphml" id="d4" yfiles.type="resources"/>
I only use yEd for quick viewing of the graph, but I assume that if a
graph doesn't display correctly on yEd, it won't display correctly on
my Flex web application based on yFiles either.
So, is there a way I can attach something like <y:Geometry
height="30.0" width="30.0" x="25.0" y="0.0"/> inside the <data
key="d1"> attribute?? this is like nested attributes, whick I don't
know if are supported by iGraph.
Thank you very much.
Post by Tamas Nepusz
Hi Karl,
Post by Dr 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
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
_______________________________________________
igraph-help mailing list
_______________________________________________
igraph-help mailing list
Tamas Nepusz
2009-11-20 10:20:32 UTC
Permalink
Post by Dr Karl
Well, I think it may be easier to store the layout like this and later
make a post-processing of the XML to write the layout information with
the needed format.
Maybe this could be done with an appropriate XSLT stylesheet or
something like that... basically you would have to inject the yFiles
schema definition to the XML header, then iterate over every <node> tag,
remove the X and Y attributes and insert the appropriate yFiles tags
instead.

Or, alternatively, take the source code of igraph_write_graph_graphml
and tweak it to your needs.
--
Tamas
Dr Karl
2009-11-20 10:38:35 UTC
Permalink
Hi Tamas,
Post by Tamas Nepusz
Or, alternatively, take the source code of igraph_write_graph_graphml
and tweak it to your needs.
That sound to me like the way to go!!!

If I make a version of igraph_write_graph_graphml compatible with
yFiles I will post it here in case someone ever needs it.

Thank you, great idea!!
Post by Tamas Nepusz
Post by Dr Karl
Well, I think it may be easier to store the layout like this and later
make a post-processing of the XML to write the layout information with
the needed format.
Maybe this could be done with an appropriate XSLT stylesheet or
something like that... basically you would have to inject the yFiles
schema definition to the XML header, then iterate over every <node> tag,
remove the X and Y attributes and insert the appropriate yFiles tags
instead.
Or, alternatively, take the source code of igraph_write_graph_graphml
and tweak it to your needs.
--
Tamas
_______________________________________________
igraph-help mailing list
Gábor Csárdi
2009-11-20 09:12:48 UTC
Permalink
Hi Karl,

the problem is, that the yFiles GraphML extensions are not supported
by igraph. (Actually I don't really know why they needed to extend
GraphML to store the coordinates.) There is currently no way to export
such a file from igraph, and most probably this will not change in the
near future.

Best,
Gabor
Post by Dr Karl
Hi Tamas,
    Thank you for your quick answer!!
    Well, I have done what you said in your message, and now
my .graphml file has two attributes. This is my code, in case someone
       igraph_t g;
       igraph_matrix_t res;
       igraph_vector_t edges;
       igraph_vector_t col1;
       igraph_vector_t col2;
       igraph_i_set_attribute_table(&igraph_cattribute_table);
       igraph_vector_init(&edges, 4*relations.size());
       igraph_matrix_init(&res, 0, 0);
       int i = 0;
       for (vector<Relationship>::iterator it = relations.begin(); it!
=relations.end(); ++it) {
               rel = (Relationship)*it;
               if (rel.AtoB>=1 && rel.BtoA>=1 && (rel.AtoB+rel.BtoA)>=minLevels) {
                       if (rel.AtoB>0 || rel.BtoA>0) {
                               VECTOR(edges)[i] = rel.nodeA;
                               i++;
                               VECTOR(edges)[i] = rel.nodeB;
                               i++;
                       }
               }
       }
       igraph_vector_resize(&edges, i);
       igraph_create(&g, &edges, 0, IGRAPH_DIRECTED);
       igraph_layout_random(&g, &res);
       long size = igraph_matrix_nrow(&res);
       igraph_vector_init(&col1, size);
       igraph_vector_init(&col2, size);
       igraph_matrix_get_col(&res, &col1, 0);
       igraph_matrix_get_col(&res, &col2, 1);
       igraph_cattribute_VAN_setv(&g, "X", &col1);
       igraph_cattribute_VAN_setv(&g, "Y", &col2);
       FILE* graphml_file;
       graphml_file = fopen("test_graph_layouts_random.graphml","w");
       igraph_write_graph_graphml(&g, graphml_file);
       igraph_vector_destroy(&edges);
       igraph_vector_destroy(&col1);
       igraph_vector_destroy(&col2);
       igraph_destroy(&g);
       igraph_matrix_destroy(&res);
Ok, now on every node I have two attributes, like this
  <node id="n0">
     <data key="X">-0.378323</data>
     <data key="Y">0.89578</data>
   </node>
but on yEd generated graphs, the layout is set like this
  <node id="n0">
     <data key="d0"/>
     <data key="d1">
       <y:ShapeNode>
         <y:Geometry height="30.0" width="30.0" x="25.0" y="0.0"/>
         <y:Fill color="#CCCCFF" transparent="false"/>
         <y:BorderStyle color="#000000" type="line" width="1.0"/>
         <y:NodeLabel alignment="center" autoSizePolicy="content"
fontFamily="Dialog" fontSize="12" fontStyle="plain"
hasBackgroundColor="false" hasLineColor="false" height="4.0"
modelName="internal" modelPosition="c" textColor="#000000"
visible="true" width="4.0" x="13.0" y="13.0"/>
         <y:Shape type="rectangle"/>
       </y:ShapeNode>
     </data>
   </node>
and before the <graph ...> tag
 <key attr.name="description" attr.type="string" for="node" id="d0"/>
 <key for="node" id="d1" yfiles.type="nodegraphics"/>
 <key attr.name="description" attr.type="string" for="edge" id="d2"/>
 <key for="edge" id="d3" yfiles.type="edgegraphics"/>
 <key for="graphml" id="d4" yfiles.type="resources"/>
I only use yEd for quick viewing of the graph, but I assume that if a
graph doesn't display correctly on yEd, it won't display correctly on
my Flex web application based on yFiles either.
So, is there a way I can attach something like <y:Geometry
height="30.0" width="30.0" x="25.0" y="0.0"/> inside the <data
key="d1"> attribute?? this is like nested attributes, whick I don't
know if are supported by iGraph.
Thank you very much.
Post by Tamas Nepusz
Hi Karl,
Post by Dr 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
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
_______________________________________________
igraph-help mailing list
_______________________________________________
igraph-help mailing list
http://lists.nongnu.org/mailman/listinfo/igraph-help
--
Gabor Csardi <***@unil.ch> UNIL DGM
Dr Karl
2009-11-20 10:33:05 UTC
Permalink
Hi Gábor,

Ok, I acnowledge the fact that I can't generate an yFiles
compatible .graphml file just from iGraph. I guess my best option is
to generate the graph and layout in .graphml with iGraph, and later
parse the .graphml file and add the yFiles-specific attributes with
another module.

I don't know either why they need to extend GraphML format to store
coordinates, but as it is a proprietary software which requires a
license to use, I think that perhaps they think that way they are
forcing people to use their library. We have bought a license for the
yFiles Flex library, for web visualization purposes. For graph and
layout generation they have an yFiles Java and yFiles .NET libraries,
which need an additional license (and it's not cheap), but we chose to
use iGraph for graph generation, metrics and statistics which we think
is a stable, reliable and fast (it's written in C) library.

So, thank you very much for your help, I didn't find any examples in
the documentation or in the mailing list, or in the net of how to
attach attributes.
Post by Tamas Nepusz
Hi Karl,
the problem is, that the yFiles GraphML extensions are not supported
by igraph. (Actually I don't really know why they needed to extend
GraphML to store the coordinates.) There is currently no way to export
such a file from igraph, and most probably this will not change in the
near future.
Best,
Gabor
Post by Dr Karl
Hi Tamas,
    Thank you for your quick answer!!
    Well, I have done what you said in your message, and now
my .graphml file has two attributes. This is my code, in case someone
       igraph_t g;
       igraph_matrix_t res;
       igraph_vector_t edges;
       igraph_vector_t col1;
       igraph_vector_t col2;
       igraph_i_set_attribute_table(&igraph_cattribute_table);
       igraph_vector_init(&edges, 4*relations.size());
       igraph_matrix_init(&res, 0, 0);
       int i = 0;
       for (vector<Relationship>::iterator it = relations.begin(); it!
=relations.end(); ++it) {
               rel = (Relationship)*it;
               if (rel.AtoB>=1 && rel.BtoA>=1 && (rel.AtoB+rel.BtoA)>=minLevels) {
                       if (rel.AtoB>0 || rel.BtoA>0) {
                               VECTOR(edges)[i] = rel.nodeA;
                               i++;
                               VECTOR(edges)[i] = rel.nodeB;
                               i++;
                       }
               }
       }
       igraph_vector_resize(&edges, i);
       igraph_create(&g, &edges, 0, IGRAPH_DIRECTED);
       igraph_layout_random(&g, &res);
       long size = igraph_matrix_nrow(&res);
       igraph_vector_init(&col1, size);
       igraph_vector_init(&col2, size);
       igraph_matrix_get_col(&res, &col1, 0);
       igraph_matrix_get_col(&res, &col2, 1);
       igraph_cattribute_VAN_setv(&g, "X", &col1);
       igraph_cattribute_VAN_setv(&g, "Y", &col2);
       FILE* graphml_file;
       graphml_file = fopen("test_graph_layouts_random.graphml","w");
       igraph_write_graph_graphml(&g, graphml_file);
       igraph_vector_destroy(&edges);
       igraph_vector_destroy(&col1);
       igraph_vector_destroy(&col2);
       igraph_destroy(&g);
       igraph_matrix_destroy(&res);
Ok, now on every node I have two attributes, like this
  <node id="n0">
     <data key="X">-0.378323</data>
     <data key="Y">0.89578</data>
   </node>
but on yEd generated graphs, the layout is set like this
  <node id="n0">
     <data key="d0"/>
     <data key="d1">
       <y:ShapeNode>
         <y:Geometry height="30.0" width="30.0" x="25.0" y="0.0"/>
         <y:Fill color="#CCCCFF" transparent="false"/>
         <y:BorderStyle color="#000000" type="line" width="1.0"/>
         <y:NodeLabel alignment="center" autoSizePolicy="content"
fontFamily="Dialog" fontSize="12" fontStyle="plain"
hasBackgroundColor="false" hasLineColor="false" height="4.0"
modelName="internal" modelPosition="c" textColor="#000000"
visible="true" width="4.0" x="13.0" y="13.0"/>
         <y:Shape type="rectangle"/>
       </y:ShapeNode>
     </data>
   </node>
and before the <graph ...> tag
 <key attr.name="description" attr.type="string" for="node" id="d0"/>
 <key for="node" id="d1" yfiles.type="nodegraphics"/>
 <key attr.name="description" attr.type="string" for="edge" id="d2"/>
 <key for="edge" id="d3" yfiles.type="edgegraphics"/>
 <key for="graphml" id="d4" yfiles.type="resources"/>
I only use yEd for quick viewing of the graph, but I assume that if a
graph doesn't display correctly on yEd, it won't display correctly on
my Flex web application based on yFiles either.
So, is there a way I can attach something like <y:Geometry
height="30.0" width="30.0" x="25.0" y="0.0"/> inside the <data
key="d1"> attribute?? this is like nested attributes, whick I don't
know if are supported by iGraph.
Thank you very much.
Post by Tamas Nepusz
Hi Karl,
Post by Dr 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
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
_______________________________________________
igraph-help mailing list
_______________________________________________
igraph-help mailing list
http://lists.nongnu.org/mailman/listinfo/igraph-help
--
_______________________________________________
igraph-help mailing list
Loading...