How can I draw superscript for node in dot language?

498 views Asked by At

I want draw a superscript on Node in using of dot language.

Is this possible?

  • If yes, how can I do this?
  • If no, what tools should I ues to get graph like this?

enter image description here

1

There are 1 answers

1
SSteve On BEST ANSWER

The xlabel attribute creates an external label for a node or edge. The following will get you part of the way there. Once you have your entire graph created you can play with spacing to avoid overlaps.

graph {
    node [shape = circle];
    edge [style = dashed; minlen = 2];
    NOP [style = dashed; xlabel = "0"];
    node [label = "*"]; n1 n2 n3 n6 n8;
    n1 [xlabel = "1"];
    n2 [xlabel = "2"];
    n3 [xlabel = "3"];
    n6 [xlabel = "6"];
    n8 [xlabel = "8"];
    n10 [xlabel = "10"];
    NOP -- n1;
    NOP -- n2;
    NOP -- n3;
    NOP -- n6;
    NOP -- n8;
    n10 [label = "+"];
    NOP -- n10;
}

enter image description here