Ring layout

Hi everyone,

I cannot find a simple way to plot a network with all nodes on a circle. So
I develop this method (which do the job):

def ring_layout(g,radius = 100):
  N = g.num_vertices()
  pos = g.new_vertex_property("vector<double>")
  for v in g.vertices():
    i = g.vertex_index[v]
    posv = Vector_double()
    posv.append(radius*cos(2.*i*pi/N))
    posv.append(radius*sin(2.*i*pi/N))
    pos[v] = posv
  return pos

Is there a simpler way to do this in graph_tool? Is there something that I
am missing?

Thanks.

Best regards,
Julien

Seems OK. There is no built-in ring layout in graph-tool, so you have to
implement it yourself.

Note that you do not need to work with Vector_double types like you did,
since these are only meant to be used internally by the
library. Instead, you should use any regular python sequence, such as
lists or numpy arrays. I.e.

      pos[v] = [radius*cos(2.*i*pi/N), radius*sin(2.*i*pi/N)]

would do just fine.

Best,
Tiago