The graph in this problem can be created using SageMath as follows. SageMath moves the nodes around around from their original position.

Here is the matrix of the relation defined by the graph.

Here is the matrix of composition of s with itself. This is done by doing ordinary matrix multiplication but then replacing all positive numbers with a 1.

Here is the digraph of s^2. Again, SageMath moves the nodes around around from their original position.

Here is the matrix of the transitive closure of s.

The definition of "transitive closure" varies a bit from one reference to the next. SageMath uses a definition that doesn't include self loops, so the following computation is close, but doesn't conform to the definition in our tex.