I've been playing with using [Graphviz](https://www.graphviz.org/) for some of my diagrams. There's a site where you can [run this online](http://www.webgraphviz.com/). I'm using the [dot language](https://graphviz.gitlab.io/_pages/pdf/dotguide.pdf) I'll paste my code for it here with some explanation:

```
digraph Anindya {
rankdir=TB;
size="8,5"
node [shape = circle]; 11; 12; 13; 21; 22; 23
subgraph {rank=source; 11; 12; 13}
subgraph {rank=sink; 21; 22; 23}
edge [arrowhead=none]
11 -> 12 [label="~_P" color=red]
12 -> 22 [label="~_Q" color=blue]
22 -> 23 [label="~_P" color=red]
23 -> 13 [label="~_Q" color=blue]
21 -> 22 [style=invis]
}
```

The dot format can be thought of as ordering the nodes in the graph topologically. `rankdir` says the first element should be at the top, and move down. You can also do `LR`, `RL`, `BT`.

I've specified each of the nodes (though this isn't strictly needed) on line 4. Nodes can be used in edges first if you want.

I've gathered the top row (11, 12, 13) and bottom row (21, 22, 23) into subgraphs in order to force the order.

I have a connection between 21 and 22 which is not actually in the graph, I've made its style `invis`. This was because the renderer kept putting 21 on the right in its row, contrary to the image we actually want. Adding invisible connections (and nodes!) can force certain layouts to happen.

There are ways to include styled text so we can actually get the subscript. I don't know how to do that right now.