  For an additive submonoid $\mathcal{M}$ of $\mathbb{R}_{\ge 0}$, the weight
of an $\mathcal{M}$-labeled directed graph is the sum of all of its edge
labels, while the content is the product of the labels. Having fixed
$\mathcal{M}$ and a directed tree $E$, we prove a general result on the shape
of directed $\mathcal{M}$-labeled graphs $\Gamma$ of weight $N\in \mathcal{M}$
maximizing the sum of the contents of all copies $E\subset \Gamma$.
  This specializes to recover a result of Hajac and Tobolski on the maximal
number of length-$k$ paths in a directed acyclic graph. It also applies to
prove a conjecture by the same authors on the maximal sum of entries of $A^k$
for a nilpotent $\mathbb{R}_{\ge 0}$-valued square matrix $A$ whose entries add
up to $N$. Finally, we apply the same techniques to obtain the maximal number
of stars with $a$ arms in a directed graph with $N$ edges.
