2

In the attached figure, the nodes are arranged in a circle around the node. Is there a (possibly generic) way to arrange the nodes only in the lower semi-circle, without having to provide fixed coordinates for the nodes?

Nodes arranged on a circular path using graphviz

Edit: Would like to achieve something like shown in the image attached below. As one can see - all the nodes are arranged in the lower semi-circular region (this figure was made using CMap Tools).

Semi-Circle (made with CMap)

The code is trivial, but pasting it anyway.

digraph semicircle {

    rankdir="TD"
    graph [nodesep="0.1", ranksep="0.3", center=true]
    mindist="0.4"

    S [label="Root", style="filled", fillcolor="greenyellow", shape="box"]

    subgraph cluster1 {
             rank="same"
             A; B; C; D; 
             S -> {A, B, C, D};
    }    }
solyarist
  • 424
  • 3
  • 17
  • I'm not sure what you want, ca you add an image of what you want? Please also add the code you used to generate the image. maybe a `rank` command is what you are searching for. – albert Dec 05 '19 at 13:40
  • @albert added an image and code. I am not sure how rank command should solve that. As you can see, the nodes should lie on the semi-circle, (either lower or upper). The question statement for the generic problem would be whether it is possible to arrange nodes in an arc, and how to do so. – solyarist Dec 05 '19 at 15:59
  • the usual approach for this kind of thing is to add more but invisible nodes and edges – Jens Jan 16 '20 at 21:49

2 Answers2

1

using dot/circo : graphviz version 2.40.1 I noted that circo placed nodes counter-clockwise, starting at 3 o'clock. I added enough invisible nodes to fill the 2 through 10 o'clock positions. To make the inter-nodal distances even more uniform I added:

 node [shape=square style=rounded]

The result I got is this: enter image description here

sroush
  • 5,375
  • 2
  • 5
  • 11
0

Try this:

digraph semicircle {

    rankdir="TD"
    graph [nodesep="0.1", ranksep="0.3", center=true, root=S]
    mindist="0.4"

    S [label="Root", style="filled", fillcolor="greenyellow", shape="box"]

    subgraph cluster1 {
             rank="same"
             A
             z1[style=invis label=""]
             z2[style=invis label=""]
             B; C; D;

             S -> A
             S -> z1,z2 [style=invis]
             S -> { B, C, D};
    }   
 }
sroush
  • 5,375
  • 2
  • 5
  • 11
  • It would be nice if you could explain to us what your code does. – Simas Joneliunas Feb 07 '20 at 02:44
  • sure this is placing the nodes in the lower arc, but the distances between the nodes are not uniform. Also, the rest of the nodes except A are being placed together in the quadrant. The trick used is good one, but does not seem to be generic or neat enough. – solyarist Feb 07 '20 at 19:11