igraph-help
[Top][All Lists]

## Re: [igraph] [C] Drawing algorithms - coordinates question

 From: Gábor Csárdi Subject: Re: [igraph] [C] Drawing algorithms - coordinates question Date: Wed, 3 Feb 2010 15:45:12 +0100

```Hi,

On Wed, Feb 3, 2010 at 3:30 PM, Vladimir Petrov <address@hidden> wrote:
> Hello!
>
> http://igraph.sourceforge.net/doc/html/ch14s01.html
>
> "Layout generator functions (or at least most of them) try to place the
> vertices  and  edges  of a graph on a 2D plane or in 3D space in a way
> which visually pleases the human eye.
>
> They  take  a graph object and a number of parameters as arguments and
> return  an igraph_matrix_t, in which each row gives the coordinates of
> a vertex."
>
> Just want to precise:
> 1) In what units of measure result is represented? Pixels, inches or
> some abstract units? For example, if i work with pixels, do i need just
> set every parameter of the draw function (maxdelta, area, repulsrad
> etc)? Is it enough or should i do some addition calculations?

arbitrary units. The vertices are assumed to be point-like. You need
to scale the calculated layout or adjust the sizes of the vertices.

> 2) What negatives values in the result matrix do mean? If there is
> strong cartesian coordinates with 4 qusters, where the (0,0) point is?
> Does "proot" vertex (one of the incoming parameters for the layout
> funtion) have (0,0) coordinates?

Negative values are just like positive values, there is no difference.
The layout is not centered, you will need to center it for yourself,
if you want it to be centered.

You mean the 'proot' argument for LGL? Yes, that is placed at (0,0),
but again, this might not be the (visual or other) center of the
layout at the end.

> 3) How to calculate "area" parameter? In case of drawing on the
> screens, is it right to just calculate the square multiplying height
> pixels with weight pixels?

See the R documentation at
http://igraph.sourceforge.net/doc/R/layout.html
for some sensible default values.

Btw. the LGL layout in igraph is not the best one, maybe the original
LGL implementation is better. Another option for graphs is the DrL
layout, that works quite well.

> 4) The most stupid question: after the drawing function complete, the
> matrix x has a size of cols = a vertex number and rows = 2.
> Does x[0,0] mean "x" coordinate and x[0,1] "y" coordinate for vertex 0?

Rows = number of vertices
Columns = 2
[...]

Best,
Gabor

--