Discussion:
[igraph] Coordinate ranges for the output of layout algorithms
Dr Karl
2010-04-01 09:47:34 UTC
Permalink
Good Morning,

I've been working with the igraph library to generate some graphs
from raw data in graphml format and I need to later on load the graphs
with the yWorks yFiles Flex library. You might remember a question
about layouts in yWorks some months ago.

I've successfully generated layouts with yWorks non-standard graphml
tags, but after some experimentation I've found out that the
coordinate spaces of yWorks and igraph are quite different from each
other. In particular, I've determined that yWorks coordinates for x
and y are only in the positive side (meaning that all nodes/vertices
have coordinates ranging from 0..1600 aproximately), and experimenting
with igraph, the coordinates after layout calculation are in the range
of -40..40 for kamada-kawai for example (but I've found wider ranges
for other layout algorithms like graphopt).

Could you please tell me which is the coordinate range for the output
of the layout algorithms in igraph? Is this range different for every
layout algorithm or it remains the same for all?

Also, with yWorks yEd I like the graphs with organic layout algorithm
applied, which I've read somewhere it is a spring-embedder type
algorithm. Is there a similiar layout algorithm in igraph? I've seen a
layout_spring in the R documentation for igraph, but since I'm using
the C implementation of the library and there is no such layout_spring
algorithm in the C documentation for igraph I was wondering if it's
not implemented or perhaps it has a different name.

Thank you in advance.

Yours sincerely,
Tamas Nepusz
2010-04-01 22:36:02 UTC
Permalink
Dear Karl,
Post by Dr Karl
Could you please tell me which is the coordinate range for the output
of the layout algorithms in igraph? Is this range different for every
layout algorithm or it remains the same for all?
The range is different for every layout algorithm, and there are no range limits. These coordinates are pretty much in an abstract coordinate space that do not relate to pixels or any other units whatsoever. In higher level interfaces we usually scale and shift these coordinates to screen coordinates before plotting a graph; i.e., the Python interface takes a Cairo drawing context and ensures that the graph being drawn fits exactly in the bounding box of the drawing context.
Post by Dr Karl
Also, with yWorks yEd I like the graphs with organic layout algorithm
applied, which I've read somewhere it is a spring-embedder type
algorithm. Is there a similiar layout algorithm in igraph?
igraph_layout_springs is left unimplemented in the C API, that's why it is undocumented. We have ported the graphopt layout algorithm of Michael Schmuhl, which build on physical analogies: each edge is represented as a spring and each node is represented as an electrically charged particle. So, this algorithm might be close to the organic layout in yFiles, but I don't know the internal details of the organic layout to say this with high confidence. Anyway, check out igraph_layout_graphopt in the C API docs to see whether this is what you are looking for. More information about the algorithm can also be found at http://schmuhl.org/graphopt/

Best,
--
Tamas
Loading...