Example 6.2.5.3. Let $G$ be a directed graph, let $\operatorname{\mathcal{C}}= \operatorname{Path}[G]$ denote its path category (Construction 1.3.7.1), and let $S$ be the collection of morphisms of $\operatorname{\mathcal{C}}$ which are either identity morphisms or are indecomposable. Then every morphism $f: X \rightarrow Z$ in $\operatorname{\mathcal{C}}$ admits a (unique) $S$-optimal factorization:
If $f = \operatorname{id}_{X}$ is an identity morphism, then its $S$-optimal factorization is given by the diagram $X \xrightarrow { \operatorname{id}_ X } X \xrightarrow { \operatorname{id}_{X} } X$.
If $f$ is not an identity morphism, then it admits a unique factorization $X \xrightarrow {g} Y \xrightarrow {s} Z$, where $s$ is an indecomposable morphism of $\operatorname{\mathcal{C}}$ (that is, a morphism which corresponds to an edge of the graph $G$); this factorization is $S$-optimal.