Dan Oneata wrote:
> Does anyone know how to solve the second part of the puzzle, that is, how to change the monoidal poset to count paths of length \$$n\$$ separately for each \$$n\$$?

Perhaps the right thing would be the monoidal poset with object set \$$\mathbb{N}^\mathbb{N}\$$, infinite sequences of natural numbers, with the product partial order, and with monoidal operation given by convolution?

Edit: Actually, I think there's a problem with this if the graph contains cycles. Then if \$$p: x\to y\$$, \$$q: y\to y\$$, and \$$r: y\to z\$$ are paths, we'd be double-counting the path \$$p;q;r : x\to z\$$ both as the concatenation of \$$p;q\$$ with \$$r\$$ and as the concatenation of \$$p\$$ with \$$q; r\$$. This problem doesn't arise in the "all paths" version Dan describes, since the concatenation function \$$\mathrm{Path}(x,y)\times\mathrm{Path}(y,z) \to \mathrm{Path}(x,z)\$$ is either injective or both sides are infinite.