(Using V9 on Ubuntu)

Consider the following code, to create a graph.

f[x_] := Mod[x^11, 100]; 
NV = 22;
V = Table[i, {i, 1, NV}]
FV = Table[f[V[[i]]], {i, 1, NV}]
EV = Table[DirectedEdge[V[[i]], FV[[i]]], {i, 1, NV}]

The output is nice.

enter image description here

From the Help we get a way to change the vertex layout:

enter image description here

So I defined a function for circular layout and tried again:

circle[n_] := Table[{Cos[2 Pi/n u], Sin[2 Pi/n u]}, {u, 1, n}]
Graph[EV, VertexCoordinates -> circle[NV]]

but the output was only a list of points:

enter image description here

What am I missing?


1 Answer 1

vn = VertexCount[Graph[EV]]
(* 36 *)
Graph[EV, VertexCoordinates -> circle[vn]]

enter image description here

  • $\begingroup$ Do you know why is necessary to compute the vertex again? vn is not equal to NV! $\endgroup$
    – Sigur
    Dec 22, 2014 at 15:25
  • 1
    $\begingroup$ @Sigur, a graph with EdgeList EV has nv (36) vertices, not NV (22); and the setting for the VertexCoordinates option should be a list of length 36 (a coordinate for each vertex). (BTW, you might want to change "vertex shape" in your post to "vertex layout" or to "vertex coordinates".) $\endgroup$
    – kglr
    Dec 22, 2014 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.