How to control which nodes get placed at each radius with GraphLayout → “RadialEmbedding”?

I have a directed graph each of whose nodes belongs to exactly one of three groups: "sources", "sinks", and "both". As these names suggest, nodes in the "sources" group have only outgoing edges; those in the "sinks" group have only incoming edges; and those in the "both" group can have both outgoing and incoming edges.

I want to lay out this graph using a radial embedding, with the nodes arranged in three concentric circles depending on which group they belong to: "sinks" in the outermost circle, "sources" in the innermost circle, and "both" in the circle in-between.

If I use the option GraphLayout → "RadialEmbedding" I indeed get a radial layout for the graph, but I don't get to specify which nodes go where (nor, for that matter, the number of possible radii from the center). Is there a way to do this?

(Note, as long as the nodes get placed along the appropriate circles, I'd like to leave it to the layout algorithm to optimize the relative position of the nodes so as to minimize the number of edge-crossings.)

• You can choose the root node as a suboption as in GraphLayout -> {"RadialEmbedding", "RootVertex" -> "a"}. See, for example, this answer to a related question. – kglr Oct 28 '14 at 14:00
• if you can add some examples, that will be very helpful... – halmir Oct 28 '14 at 14:48

ClearAll[circularKPartiteF];
circularKPartiteF = With[{rl = Range[Length@{##}]},
Join @@ (2^rl (GraphComputation`CircularEmbedding /@ {##}))] &;

Example 1: a complete graph

Graph[Range, EdgeList[CompleteGraph[{3, 7, 15}]],
VertexSize -> Large,
VertexStyle -> Join[Thread[Range@3 -> Red], Thread[Range[4, 10] -> Green],
Thread[Range[11, 25] -> Blue]],
VertexCoordinates -> circularKPartiteF[3, 7, 15]] Example 2: David's example

Graph[Range@40, DeleteDuplicates[Join[myFirstRules, mySecondRules]],
VertexSize -> Large,
VertexStyle -> Join[Thread[mySources -> Red],
VertexCoordinates -> circularKPartiteF[10, 10, 20]] It appears to be very difficult to use GraphLayout -> RadialEmbedding in your case but you can place your Vertexes using VertexCoordinates.

mySources = Range[1, 10];

myBoth = Range[11, 20];

mySinks = Range[21, 40];

myFirstRules =
Table[Rule[RandomChoice[mySources], RandomChoice[myBoth]], {30}];

mySecondRules =
Table[Rule[RandomChoice[myBoth], RandomChoice[mySinks]], {60}];

myVertexCoordinates =
Join[Table[{Cos[\[Theta]], Sin[\[Theta]]}, {\[Theta], 0,
2 \[Pi] - (2 \[Pi] )/Length[mySources], (2 \[Pi] )/
Length[mySources]}],
Table[2 {Cos[\[Theta]], Sin[\[Theta]]}, {\[Theta], 0,
2 \[Pi] - (2 \[Pi] )/Length[myBoth], (2 \[Pi] )/Length[myBoth]}],
Table[3 {Cos[\[Theta]], Sin[\[Theta]]}, {\[Theta], 0,
2 \[Pi] - (2 \[Pi] )/Length[mySinks], (2 \[Pi] )/
Length[mySinks]}]];

Graph[mySources \[Union] myBoth \[Union] mySinks, myFirstRules \[Union] mySecondRules,
VertexCoordinates -> myVertexCoordinates] This only work when graph is well structured like David's example and know source, sink, and both:

g = Graph[Range@40, DeleteDuplicates[Join[myFirstRules, mySecondRules]]];
add1 = Thread["s" -> Select[mySources, VertexOutDegree[g, #] > 0 &]];
Select[myBoth, (VertexOutDegree[g, #] == 0 &&
VertexInDegree[g, #] != 0) &] -> "out"];
"ss" -> Select[
myBoth, (VertexInDegree[g, #] == 0 &&
VertexOutDegree[g, #] != 0) &]];
If[add3 =!= {}, AppendTo[add3, "s" -> "ss"]];

vcoord = GraphEmbedding[
Graph[Join[VertexList[g], {"s", "ss", "out"}], 